|
10 | 10 | * Written by Peter Eisentraut <peter_e@gmx.net>.
|
11 | 11 | *
|
12 | 12 | * IDENTIFICATION
|
13 |
| - * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.309 2006/01/09 10:05:31 petere Exp $ |
| 13 | + * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.310 2006/02/04 12:50:47 petere Exp $ |
14 | 14 | *
|
15 | 15 | *--------------------------------------------------------------------
|
16 | 16 | */
|
@@ -2201,6 +2201,7 @@ static void ReportGUCOption(struct config_generic * record);
|
2201 | 2201 | static void ShowGUCConfigOption(const char *name, DestReceiver *dest);
|
2202 | 2202 | static void ShowAllGUCConfig(DestReceiver *dest);
|
2203 | 2203 | static char *_ShowOption(struct config_generic * record);
|
| 2204 | +static bool is_newvalue_equal(struct config_generic *record, const char *newvalue); |
2204 | 2205 |
|
2205 | 2206 |
|
2206 | 2207 | /*
|
@@ -3631,7 +3632,15 @@ set_config_option(const char *name, const char *value,
|
3631 | 3632 | break;
|
3632 | 3633 | case PGC_POSTMASTER:
|
3633 | 3634 | if (context == PGC_SIGHUP)
|
| 3635 | + { |
| 3636 | + if (changeVal && !is_newvalue_equal(record, value)) |
| 3637 | + ereport(elevel, |
| 3638 | + (errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM), |
| 3639 | + errmsg("parameter \"%s\" cannot be changed after server start; configuration file change ignored", |
| 3640 | + name))); |
| 3641 | + |
3634 | 3642 | return true;
|
| 3643 | + } |
3635 | 3644 | if (context != PGC_POSTMASTER)
|
3636 | 3645 | {
|
3637 | 3646 | ereport(elevel,
|
@@ -5079,6 +5088,44 @@ _ShowOption(struct config_generic * record)
|
5079 | 5088 | }
|
5080 | 5089 |
|
5081 | 5090 |
|
| 5091 | +static bool |
| 5092 | +is_newvalue_equal(struct config_generic *record, const char *newvalue) |
| 5093 | +{ |
| 5094 | + switch (record->vartype) |
| 5095 | + { |
| 5096 | + case PGC_BOOL: |
| 5097 | + { |
| 5098 | + struct config_bool *conf = (struct config_bool *) record; |
| 5099 | + bool newval; |
| 5100 | + |
| 5101 | + return parse_bool(newvalue, &newval) && *conf->variable == newval; |
| 5102 | + } |
| 5103 | + case PGC_INT: |
| 5104 | + { |
| 5105 | + struct config_int *conf = (struct config_int *) record; |
| 5106 | + int newval; |
| 5107 | + |
| 5108 | + return parse_int(newvalue, &newval) && *conf->variable == newval; |
| 5109 | + } |
| 5110 | + case PGC_REAL: |
| 5111 | + { |
| 5112 | + struct config_real *conf = (struct config_real *) record; |
| 5113 | + double newval; |
| 5114 | + |
| 5115 | + return parse_real(newvalue, &newval) && *conf->variable == newval; |
| 5116 | + } |
| 5117 | + case PGC_STRING: |
| 5118 | + { |
| 5119 | + struct config_string *conf = (struct config_string *) record; |
| 5120 | + |
| 5121 | + return strcmp(*conf->variable, newvalue) == 0; |
| 5122 | + } |
| 5123 | + } |
| 5124 | + |
| 5125 | + return false; |
| 5126 | +} |
| 5127 | + |
| 5128 | + |
5082 | 5129 | #ifdef EXEC_BACKEND
|
5083 | 5130 |
|
5084 | 5131 | /*
|
|
0 commit comments