Commit 2938eec7 authored by Tom Lane's avatar Tom Lane

Extend GUC concepts of parse_hook and assign_hook to all four supported

datatypes, not only strings.  parse_hook is useless for bool, I suppose,
but it seems possibly useful for int and double to apply variable-specific
constraints that are more complex than simple range limits.  assign_hook
is definitely useful for all datatypes --- we need it right now for bool
to support date cache reset when changing Australian timezone rule setting.
Also, clean up some residual problems with the reset all/show all patch,
including memory leaks and mistaken reset of PostPortNumber.  It seems
best that RESET ALL not touch variables that don't have SUSET or
USERSET context.
parent 89765fa5
......@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.108 2001/06/03 14:53:56 petere Exp $
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.109 2001/06/12 22:54:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -243,7 +243,7 @@ BootstrapMain(int argc, char *argv[])
dbName = NULL;
if (!IsUnderPostmaster)
{
ResetAllOptions();
ResetAllOptions(true);
potential_DataDir = getenv("PGDATA"); /* Null if no PGDATA
* variable */
}
......
......@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.49 2001/06/07 04:50:56 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.50 2001/06/12 22:54:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -792,7 +792,9 @@ ResetPGVariable(const char *name)
reset_datestyle();
reset_timezone();
ResetAllOptions();
ResetAllOptions(false);
} else
SetConfigOption(name, NULL, superuser() ? PGC_SUSET : PGC_USERSET, false);
SetConfigOption(name, NULL,
superuser() ? PGC_SUSET : PGC_USERSET,
false);
}
......@@ -28,7 +28,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.218 2001/06/11 04:12:29 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.219 2001/06/12 22:54:05 tgl Exp $
*
* NOTES
*
......@@ -362,9 +362,13 @@ PostmasterMain(int argc, char *argv[])
/*
* Options setup
*/
potential_DataDir = getenv("PGDATA"); /* default value */
ResetAllOptions(true);
/* PGPORT environment variable, if set, overrides GUC setting */
if (getenv("PGPORT"))
PostPortNumber = atoi(getenv("PGPORT"));
ResetAllOptions();
potential_DataDir = getenv("PGDATA"); /* default value */
/*
* First we must scan for a -D argument to get the data dir. Then read
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.219 2001/06/07 04:50:57 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.220 2001/06/12 22:54:06 tgl Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
......@@ -1156,7 +1156,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
if (!IsUnderPostmaster)
{
ResetAllOptions();
ResetAllOptions(true);
potential_DataDir = getenv("PGDATA");
}
StatFp = stderr;
......@@ -1709,7 +1709,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
if (!IsUnderPostmaster)
{
puts("\nPOSTGRES backend interactive interface ");
puts("$Revision: 1.219 $ $Date: 2001/06/07 04:50:57 $\n");
puts("$Revision: 1.220 $ $Date: 2001/06/12 22:54:06 $\n");
}
/*
......
This diff is collapsed.
......@@ -4,7 +4,7 @@
* External declarations pertaining to backend/utils/misc/guc.c and
* backend/utils/misc/guc-file.l
*
* $Header: /cvsroot/pgsql/src/include/utils/guc.h,v 1.7 2001/06/07 04:50:57 momjian Exp $
* $Id: guc.h,v 1.8 2001/06/12 22:54:06 tgl Exp $
*/
#ifndef GUC_H
#define GUC_H
......@@ -46,13 +46,15 @@ typedef enum
} GucContext;
void SetConfigOption(const char *name, const char *value, GucContext context, bool makeDefault);
const char *GetConfigOption(const char *name);
void ProcessConfigFile(GucContext context);
void ResetAllOptions(void);
void ParseLongOption(const char *string, char **name, char **value);
bool set_config_option(const char *name, const char *value, GucContext context, bool DoIt, bool makeDefault);
void ShowAllGUCConfig(void);
extern void SetConfigOption(const char *name, const char *value,
GucContext context, bool makeDefault);
extern const char *GetConfigOption(const char *name);
extern void ProcessConfigFile(GucContext context);
extern void ResetAllOptions(bool isStartup);
extern void ParseLongOption(const char *string, char **name, char **value);
extern bool set_config_option(const char *name, const char *value,
GucContext context, bool DoIt, bool makeDefault);
extern void ShowAllGUCConfig(void);
extern bool Debug_print_query;
......
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