Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3fa9c41

Browse files
committed
Issue a warning if a change-on-restart-only postgresql.conf value is
modified and the server config files are reloaded
1 parent bc6a824 commit 3fa9c41

File tree

3 files changed

+52
-5
lines changed

3 files changed

+52
-5
lines changed

doc/TODO

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Administration
8383
o %Allow postgresql.conf file values to be changed via an SQL
8484
API, perhaps using SET GLOBAL
8585
o Allow the server to be stopped/restarted via an SQL API
86-
o Issue a warning if a change-on-restart-only postgresql.conf value
86+
o -Issue a warning if a change-on-restart-only postgresql.conf value
8787
is modified and the server config files are reloaded
8888
o Mark change-on-restart-only values in postgresql.conf
8989

doc/src/FAQ/TODO.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ <h1><a name="section_2">Administration</a></h1>
2626

2727
<ul>
2828
<li>%Remove behavior of postmaster -o
29-
</li><li>-*%Allow pooled connections to list all prepared statements*
29+
</li><li>-<em>%Allow pooled connections to list all prepared statements</em>
3030
<p> This would allow an application inheriting a pooled connection to know
3131
the statements prepared in the current session.
3232
</p>
@@ -79,8 +79,8 @@ <h1><a name="section_2">Administration</a></h1>
7979
</li><li>%Allow postgresql.conf file values to be changed via an SQL
8080
API, perhaps using SET GLOBAL
8181
</li><li>Allow the server to be stopped/restarted via an SQL API
82-
</li><li>Issue a warning if a change-on-restart-only postgresql.conf value
83-
is modified and the server config files are reloaded
82+
</li><li>-<em>Issue a warning if a change-on-restart-only postgresql.conf value
83+
is modified and the server config files are reloaded</em>
8484
</li><li>Mark change-on-restart-only values in postgresql.conf
8585
</li></ul>
8686
</li><li>Tablespaces

src/backend/utils/misc/guc.c

+48-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
1111
*
1212
* 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 $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -2201,6 +2201,7 @@ static void ReportGUCOption(struct config_generic * record);
22012201
static void ShowGUCConfigOption(const char *name, DestReceiver *dest);
22022202
static void ShowAllGUCConfig(DestReceiver *dest);
22032203
static char *_ShowOption(struct config_generic * record);
2204+
static bool is_newvalue_equal(struct config_generic *record, const char *newvalue);
22042205

22052206

22062207
/*
@@ -3631,7 +3632,15 @@ set_config_option(const char *name, const char *value,
36313632
break;
36323633
case PGC_POSTMASTER:
36333634
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+
36343642
return true;
3643+
}
36353644
if (context != PGC_POSTMASTER)
36363645
{
36373646
ereport(elevel,
@@ -5079,6 +5088,44 @@ _ShowOption(struct config_generic * record)
50795088
}
50805089

50815090

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+
50825129
#ifdef EXEC_BACKEND
50835130

50845131
/*

0 commit comments

Comments
 (0)