Issue a warning if a change-on-restart-only postgresql.conf value is
authorPeter Eisentraut
Sat, 4 Feb 2006 12:50:47 +0000 (12:50 +0000)
committerPeter Eisentraut
Sat, 4 Feb 2006 12:50:47 +0000 (12:50 +0000)
modified  and the server config files are reloaded

doc/TODO
doc/src/FAQ/TODO.html
src/backend/utils/misc/guc.c

index d7e210651fc46aa7639d79396430235f410ee230..b38a717f1e24a1149ac3f71ff6402a667882b431 100644 (file)
--- a/doc/TODO
+++ b/doc/TODO
@@ -83,7 +83,7 @@ Administration
    o %Allow postgresql.conf file values to be changed via an SQL
      API, perhaps using SET GLOBAL
    o Allow the server to be stopped/restarted via an SQL API
-   o Issue a warning if a change-on-restart-only postgresql.conf value
+   o -Issue a warning if a change-on-restart-only postgresql.conf value
      is modified  and the server config files are reloaded
    o Mark change-on-restart-only values in postgresql.conf
 
index 9aafe3e9c305aa7faf81adc076b02eab67c04eaf..d9d21ac4c74170471b2db43498ba033dab63e295 100644 (file)
@@ -26,7 +26,7 @@ first.
 
 
       
  • %Remove behavior of postmaster -o
  • -  
  • -*%Allow pooled connections to list all prepared statements*
  • +  
  • -%Allow pooled connections to list all prepared statements
  •  

      This would allow an application inheriting a pooled connection to know

       the statements prepared in the current session.
     

    @@ -79,8 +79,8 @@ first.
         
  • %Allow postgresql.conf file values to be changed via an SQL
  •            API, perhaps using SET GLOBAL
         
  • Allow the server to be stopped/restarted via an SQL API
  • -    
  • Issue a warning if a change-on-restart-only postgresql.conf value
  • -          is modified  and the server config files are reloaded
    +    
  • -Issue a warning if a change-on-restart-only postgresql.conf value
  • +          is modified  and the server config files are reloaded
         
  • Mark change-on-restart-only values in postgresql.conf
  •    
       
  • Tablespaces
  • index e16bbd057b30772d3dc42a818258872321fa2136..6ff6382a482c93ac903771e9b75ee01be638993f 100644 (file)
    @@ -10,7 +10,7 @@
      * Written by Peter Eisentraut .
      *
      * 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
     
     /*