diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2006-02-04 12:50:47 +0000 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2006-02-04 12:50:47 +0000 |
commit | 3fa9c416ed14f1d46567fdcf99c8d639034dbeec (patch) | |
tree | aeb0a65fd02a6218151f8c1a387aed1ac8f30fbb /src | |
parent | bc6a824ca6c1299be32a47652e7afd3704778021 (diff) | |
download | postgresql-3fa9c416ed14f1d46567fdcf99c8d639034dbeec.tar.gz postgresql-3fa9c416ed14f1d46567fdcf99c8d639034dbeec.zip |
Issue a warning if a change-on-restart-only postgresql.conf value is
modified and the server config files are reloaded
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/utils/misc/guc.c | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index e16bbd057b3..6ff6382a482 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -10,7 +10,7 @@ * Written by Peter Eisentraut <peter_e@gmx.net>. * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.309 2006/01/09 10:05:31 petere Exp $ + * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.310 2006/02/04 12:50:47 petere Exp $ * *-------------------------------------------------------------------- */ @@ -2201,6 +2201,7 @@ static void ReportGUCOption(struct config_generic * record); static void ShowGUCConfigOption(const char *name, DestReceiver *dest); static void ShowAllGUCConfig(DestReceiver *dest); static char *_ShowOption(struct config_generic * record); +static bool is_newvalue_equal(struct config_generic *record, const char *newvalue); /* @@ -3631,7 +3632,15 @@ set_config_option(const char *name, const char *value, break; case PGC_POSTMASTER: if (context == PGC_SIGHUP) + { + if (changeVal && !is_newvalue_equal(record, value)) + ereport(elevel, + (errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM), + errmsg("parameter \"%s\" cannot be changed after server start; configuration file change ignored", + name))); + return true; + } if (context != PGC_POSTMASTER) { ereport(elevel, @@ -5079,6 +5088,44 @@ _ShowOption(struct config_generic * record) } +static bool +is_newvalue_equal(struct config_generic *record, const char *newvalue) +{ + switch (record->vartype) + { + case PGC_BOOL: + { + struct config_bool *conf = (struct config_bool *) record; + bool newval; + + return parse_bool(newvalue, &newval) && *conf->variable == newval; + } + case PGC_INT: + { + struct config_int *conf = (struct config_int *) record; + int newval; + + return parse_int(newvalue, &newval) && *conf->variable == newval; + } + case PGC_REAL: + { + struct config_real *conf = (struct config_real *) record; + double newval; + + return parse_real(newvalue, &newval) && *conf->variable == newval; + } + case PGC_STRING: + { + struct config_string *conf = (struct config_string *) record; + + return strcmp(*conf->variable, newvalue) == 0; + } + } + + return false; +} + + #ifdef EXEC_BACKEND /* |