|
4 | 4 | * Support for grand unified configuration scheme, including SET |
5 | 5 | * command, configuration file, and command line options. |
6 | 6 | * |
7 | | - * $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.54 2001/09/3018:57:45 tgl Exp $ |
| 7 | + * $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.55 2001/09/3020:16:21 tgl Exp $ |
8 | 8 | * |
9 | 9 | * Copyright 2000 by PostgreSQL Global Development Group |
10 | 10 | * Written by Peter Eisentraut <peter_e@gmx.net>. |
@@ -704,37 +704,49 @@ set_config_option(const char *name, const char *value, |
704 | 704 | * precise rules. Note that we don't want to throw errors if we're in |
705 | 705 | * the SIGHUP context. In that case we just ignore the attempt. |
706 | 706 | */ |
707 | | -if (record->context==PGC_POSTMASTER&&context!=PGC_POSTMASTER) |
| 707 | +switch (record->context) |
708 | 708 | { |
709 | | -if (context!=PGC_SIGHUP) |
710 | | -elog(ERROR,"'%s' cannot be changed after server start",name); |
711 | | -else |
712 | | -return true; |
713 | | -} |
714 | | -elseif (record->context==PGC_SIGHUP&&context!=PGC_SIGHUP&& |
715 | | -context!=PGC_POSTMASTER) |
716 | | -{ |
717 | | -elog(ERROR,"'%s' cannot be changed now",name); |
718 | | - |
719 | | -/* |
720 | | - * Hmm, the idea of the SIGHUP context is "ought to be global, but |
721 | | - * can be changed after postmaster start". But there's nothing |
722 | | - * that prevents a crafty administrator from sending SIGHUP |
723 | | - * signals to individual backends only. |
724 | | - */ |
725 | | -} |
726 | | -elseif (record->context==PGC_BACKEND&&context!=PGC_BACKEND |
727 | | -&&context!=PGC_POSTMASTER) |
728 | | -{ |
729 | | -if (context!=PGC_SIGHUP) |
730 | | -elog(ERROR,"'%s' cannot be set after connection start",name); |
731 | | -else |
732 | | -return true; |
| 709 | +casePGC_POSTMASTER: |
| 710 | +if (context==PGC_SIGHUP) |
| 711 | +return true; |
| 712 | +if (context!=PGC_POSTMASTER) |
| 713 | +elog(ERROR,"'%s' cannot be changed after server start",name); |
| 714 | +break; |
| 715 | +casePGC_SIGHUP: |
| 716 | +if (context!=PGC_SIGHUP&&context!=PGC_POSTMASTER) |
| 717 | +elog(ERROR,"'%s' cannot be changed now",name); |
| 718 | +/* |
| 719 | + * Hmm, the idea of the SIGHUP context is "ought to be global, but |
| 720 | + * can be changed after postmaster start". But there's nothing |
| 721 | + * that prevents a crafty administrator from sending SIGHUP |
| 722 | + * signals to individual backends only. |
| 723 | + */ |
| 724 | +break; |
| 725 | +casePGC_BACKEND: |
| 726 | +if (context==PGC_SIGHUP) |
| 727 | +{ |
| 728 | +/* |
| 729 | + * If a PGC_BACKEND parameter is changed in the config file, |
| 730 | + * we want to accept the new value in the postmaster (whence |
| 731 | + * it will propagate to subsequently-started backends), but |
| 732 | + * ignore it in existing backends. This is a tad klugy, but |
| 733 | + * necessary because we don't re-read the config file during |
| 734 | + * backend start. |
| 735 | + */ |
| 736 | +if (IsUnderPostmaster) |
| 737 | +return true; |
| 738 | +} |
| 739 | +elseif (context!=PGC_BACKEND&&context!=PGC_POSTMASTER) |
| 740 | +elog(ERROR,"'%s' cannot be set after connection start",name); |
| 741 | +break; |
| 742 | +casePGC_SUSET: |
| 743 | +if (context==PGC_USERSET||context==PGC_BACKEND) |
| 744 | +elog(ERROR,"permission denied"); |
| 745 | +break; |
| 746 | +casePGC_USERSET: |
| 747 | +/* always okay */ |
| 748 | +break; |
733 | 749 | } |
734 | | -elseif (record->context==PGC_SUSET&& |
735 | | - (context==PGC_USERSET||context==PGC_BACKEND)) |
736 | | -elog(ERROR,"permission denied"); |
737 | | - |
738 | 750 |
|
739 | 751 | /* |
740 | 752 | * Evaluate value and set variable |
|