Commit f0584518 authored by Bruce Momjian's avatar Bruce Momjian

Revert (again) GUC patch to return commented fields to their default

values, due to concern about the patch.
parent 36481474
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* *
* Copyright (c) 2000-2006, PostgreSQL Global Development Group * Copyright (c) 2000-2006, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/backend/utils/misc/guc-file.l,v 1.44 2006/08/13 02:22:24 momjian Exp $ * $PostgreSQL: pgsql/src/backend/utils/misc/guc-file.l,v 1.45 2006/08/14 02:27:26 momjian Exp $
*/ */
%{ %{
...@@ -50,8 +50,7 @@ int GUC_yylex(void); ...@@ -50,8 +50,7 @@ int GUC_yylex(void);
static bool ParseConfigFile(const char *config_file, const char *calling_file, static bool ParseConfigFile(const char *config_file, const char *calling_file,
int depth, GucContext context, int elevel, int depth, GucContext context, int elevel,
struct name_value_pair **head_p, struct name_value_pair **head_p,
struct name_value_pair **tail_p, struct name_value_pair **tail_p);
int *varcount);
static void free_name_value_list(struct name_value_pair * list); static void free_name_value_list(struct name_value_pair * list);
static char *GUC_scanstr(const char *s); static char *GUC_scanstr(const char *s);
...@@ -115,11 +114,8 @@ STRING \'([^'\\\n]|\\.|\'\')*\' ...@@ -115,11 +114,8 @@ STRING \'([^'\\\n]|\\.|\'\')*\'
void void
ProcessConfigFile(GucContext context) ProcessConfigFile(GucContext context)
{ {
int elevel, i; int elevel;
struct name_value_pair *item, *head, *tail; struct name_value_pair *item, *head, *tail;
char *env;
bool *apply_list = NULL;
int varcount = 0;
Assert(context == PGC_POSTMASTER || context == PGC_SIGHUP); Assert(context == PGC_POSTMASTER || context == PGC_SIGHUP);
...@@ -138,109 +134,25 @@ ProcessConfigFile(GucContext context) ...@@ -138,109 +134,25 @@ ProcessConfigFile(GucContext context)
if (!ParseConfigFile(ConfigFileName, NULL, if (!ParseConfigFile(ConfigFileName, NULL,
0, context, elevel, 0, context, elevel,
&head, &tail, &varcount)) &head, &tail))
goto cleanup_list; goto cleanup_list;
/* Can we allocate memory here, what about leaving here prematurely? */
apply_list = (bool *) palloc(sizeof(bool) * varcount);
/* Check if all options are valid */ /* Check if all options are valid */
for (item = head, i = 0; item; item = item->next, i++) for (item = head; item; item = item->next)
{ {
bool isEqual, isContextOk; if (!set_config_option(item->name, item->value, context,
PGC_S_FILE, false, false))
if (!verify_config_option(item->name, item->value, context,
PGC_S_FILE, &isEqual, &isContextOk))
{
ereport(elevel,
(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
errmsg("configuration file is invalid")));
goto cleanup_list; goto cleanup_list;
}
if (isContextOk == false)
{
apply_list[i] = false;
if (context == PGC_SIGHUP)
{
if (isEqual == false)
ereport(elevel,
(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
errmsg("parameter \"%s\" cannot be changed after server start; configuration file change ignored",
item->name)));
}
else
/* if it is boot phase, context must be valid for all
* configuration item. */
goto cleanup_list;
}
else
apply_list[i] = true;
} }
/* If we got here all the options checked out okay, so apply them. */ /* If we got here all the options checked out okay, so apply them. */
for (item = head, i = 0; item; item = item->next, i++) for (item = head; item; item = item->next)
if (apply_list[i])
set_config_option(item->name, item->value, context,
PGC_S_FILE, false, true);
if (context == PGC_SIGHUP)
{ {
/* set_config_option(item->name, item->value, context,
* Revert all "untouched" options with reset source PGC_S_FILE to PGC_S_FILE, false, true);
* default/boot value.
*/
for (i = 0; i < num_guc_variables; i++)
{
struct config_generic *gconf = guc_variables[i];
if (gconf->reset_source == PGC_S_FILE &&
!(gconf->status & GUC_IN_CONFFILE))
{
if (gconf->context == PGC_BACKEND && IsUnderPostmaster)
; /* Be silent. Does any body want message from each session? */
else if (gconf->context == PGC_POSTMASTER)
ereport(elevel,
(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
errmsg("parameter \"%s\" cannot be changed (commented) after server start; configuration file change ignored",
gconf->name)));
else if (set_config_option(gconf->name, NULL, context,
PGC_S_FILE, false, true))
{
GucStack *stack;
gconf->reset_source = PGC_S_DEFAULT;
for (stack = gconf->stack; stack; stack = stack->prev)
if (stack->source == PGC_S_FILE)
stack->source = PGC_S_DEFAULT;
ereport(elevel,
(errcode(ERRCODE_SUCCESSFUL_COMPLETION),
errmsg("configuration option %s returned to default value", gconf->name)));
}
}
gconf->status &= ~GUC_IN_CONFFILE;
}
/*
* Revert to environment variable. PGPORT is ignored, because it cannot be
* set in running state.
*/
env = getenv("PGDATESTYLE");
if (env != NULL)
set_config_option("datestyle", env, context,
PGC_S_ENV_VAR, false, true);
env = getenv("PGCLIENTENCODING");
if (env != NULL)
set_config_option("client_encoding", env, context,
PGC_S_ENV_VAR, false, true);
} }
cleanup_list: cleanup_list:
if (apply_list)
pfree(apply_list);
free_name_value_list(head); free_name_value_list(head);
} }
...@@ -277,14 +189,13 @@ static bool ...@@ -277,14 +189,13 @@ static bool
ParseConfigFile(const char *config_file, const char *calling_file, ParseConfigFile(const char *config_file, const char *calling_file,
int depth, GucContext context, int elevel, int depth, GucContext context, int elevel,
struct name_value_pair **head_p, struct name_value_pair **head_p,
struct name_value_pair **tail_p, struct name_value_pair **tail_p)
int *varcount)
{ {
bool OK = true; bool OK = true;
char abs_path[MAXPGPATH]; char abs_path[MAXPGPATH];
FILE *fp; FILE *fp;
YY_BUFFER_STATE lex_buffer; YY_BUFFER_STATE lex_buffer;
int token; int token;
/* /*
* Reject too-deep include nesting depth. This is just a safety check * Reject too-deep include nesting depth. This is just a safety check
...@@ -378,7 +289,7 @@ ParseConfigFile(const char *config_file, const char *calling_file, ...@@ -378,7 +289,7 @@ ParseConfigFile(const char *config_file, const char *calling_file,
if (!ParseConfigFile(opt_value, config_file, if (!ParseConfigFile(opt_value, config_file,
depth + 1, context, elevel, depth + 1, context, elevel,
head_p, tail_p, varcount)) head_p, tail_p))
{ {
pfree(opt_name); pfree(opt_name);
pfree(opt_value); pfree(opt_value);
...@@ -422,7 +333,6 @@ ParseConfigFile(const char *config_file, const char *calling_file, ...@@ -422,7 +333,6 @@ ParseConfigFile(const char *config_file, const char *calling_file,
else else
(*tail_p)->next = item; (*tail_p)->next = item;
*tail_p = item; *tail_p = item;
(*varcount)++;
} }
/* break out of loop if read EOF, else loop for next line */ /* break out of loop if read EOF, else loop for next line */
......
This diff is collapsed.
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Copyright (c) 2000-2006, PostgreSQL Global Development Group * Copyright (c) 2000-2006, PostgreSQL Global Development Group
* Written by Peter Eisentraut <peter_e@gmx.net>. * Written by Peter Eisentraut <peter_e@gmx.net>.
* *
* $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.74 2006/08/13 01:30:17 momjian Exp $ * $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.75 2006/08/14 02:27:27 momjian Exp $
*-------------------------------------------------------------------- *--------------------------------------------------------------------
*/ */
#ifndef GUC_H #ifndef GUC_H
...@@ -193,9 +193,6 @@ extern void ParseLongOption(const char *string, char **name, char **value); ...@@ -193,9 +193,6 @@ extern void ParseLongOption(const char *string, char **name, char **value);
extern bool set_config_option(const char *name, const char *value, extern bool set_config_option(const char *name, const char *value,
GucContext context, GucSource source, GucContext context, GucSource source,
bool isLocal, bool changeVal); bool isLocal, bool changeVal);
extern bool verify_config_option(const char *name, const char *value,
GucContext context, GucSource source,
bool *isNewEqual, bool *isContextOK);
extern char *GetConfigOptionByName(const char *name, const char **varname); extern char *GetConfigOptionByName(const char *name, const char **varname);
extern void GetConfigOptionByNum(int varnum, const char **values, bool *noshow); extern void GetConfigOptionByNum(int varnum, const char **values, bool *noshow);
extern int GetNumConfigOptions(void); extern int GetNumConfigOptions(void);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/include/utils/guc_tables.h,v 1.27 2006/08/13 02:22:24 momjian Exp $ * $PostgreSQL: pgsql/src/include/utils/guc_tables.h,v 1.28 2006/08/14 02:27:27 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -143,8 +143,7 @@ struct config_generic ...@@ -143,8 +143,7 @@ struct config_generic
#define GUC_HAVE_TENTATIVE 0x0001 /* tentative value is defined */ #define GUC_HAVE_TENTATIVE 0x0001 /* tentative value is defined */
#define GUC_HAVE_LOCAL 0x0002 /* a SET LOCAL has been executed */ #define GUC_HAVE_LOCAL 0x0002 /* a SET LOCAL has been executed */
#define GUC_HAVE_STACK 0x0004 /* we have stacked prior value(s) */ #define GUC_HAVE_STACK 0x0004 /* we have stacked prior value(s) */
#define GUC_IN_CONFFILE 0x0008 /* value shows up in the configuration
file (is not commented) */
/* GUC records for specific variable types */ /* GUC records for specific variable types */
...@@ -154,12 +153,11 @@ struct config_bool ...@@ -154,12 +153,11 @@ struct config_bool
/* these fields must be set correctly in initial value: */ /* these fields must be set correctly in initial value: */
/* (all but reset_val are constants) */ /* (all but reset_val are constants) */
bool *variable; bool *variable;
bool boot_val; bool reset_val;
GucBoolAssignHook assign_hook; GucBoolAssignHook assign_hook;
GucShowHook show_hook; GucShowHook show_hook;
/* variable fields, initialized at runtime: */ /* variable fields, initialized at runtime: */
bool tentative_val; bool tentative_val;
bool reset_val;
}; };
struct config_int struct config_int
...@@ -168,14 +166,13 @@ struct config_int ...@@ -168,14 +166,13 @@ struct config_int
/* these fields must be set correctly in initial value: */ /* these fields must be set correctly in initial value: */
/* (all but reset_val are constants) */ /* (all but reset_val are constants) */
int *variable; int *variable;
int boot_val; int reset_val;
int min; int min;
int max; int max;
GucIntAssignHook assign_hook; GucIntAssignHook assign_hook;
GucShowHook show_hook; GucShowHook show_hook;
/* variable fields, initialized at runtime: */ /* variable fields, initialized at runtime: */
int tentative_val; int tentative_val;
int reset_val;
}; };
struct config_real struct config_real
...@@ -184,14 +181,13 @@ struct config_real ...@@ -184,14 +181,13 @@ struct config_real
/* these fields must be set correctly in initial value: */ /* these fields must be set correctly in initial value: */
/* (all but reset_val are constants) */ /* (all but reset_val are constants) */
double *variable; double *variable;
double boot_val; double reset_val;
double min; double min;
double max; double max;
GucRealAssignHook assign_hook; GucRealAssignHook assign_hook;
GucShowHook show_hook; GucShowHook show_hook;
/* variable fields, initialized at runtime: */ /* variable fields, initialized at runtime: */
double tentative_val; double tentative_val;
double reset_val;
}; };
struct config_string struct config_string
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment