aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/bootstrap/bootstrap.c4
-rw-r--r--src/backend/postmaster/postmaster.c10
-rw-r--r--src/backend/tcop/postgres.c4
-rw-r--r--src/backend/utils/misc/guc.c46
-rw-r--r--src/include/utils/guc.h4
5 files changed, 57 insertions, 11 deletions
diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c
index 8d765605b10..150c29db3f6 100644
--- a/src/backend/bootstrap/bootstrap.c
+++ b/src/backend/bootstrap/bootstrap.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.220 2006/07/14 14:52:17 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.221 2006/07/29 03:02:55 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -358,6 +358,8 @@ BootstrapMain(int argc, char *argv[])
proc_exit(1);
/* If timezone is not set, determine what the OS uses */
pg_timezone_initialize();
+ /* If timezone_abbreviations is not set, select default */
+ pg_timezone_abbrev_initialize();
}
/* Validate we have been given a reasonable-looking DataDir */
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 9d4bc76755a..13492bfec8b 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.496 2006/07/25 01:23:34 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.497 2006/07/29 03:02:55 tgl Exp $
*
* NOTES
*
@@ -691,11 +691,17 @@ PostmasterMain(int argc, char *argv[])
* should be done during GUC initialization, but because it can take as
* much as several seconds, we delay it until after we've created the
* postmaster.pid file. This prevents problems with boot scripts that
- * expect the pidfile to appear quickly.)
+ * expect the pidfile to appear quickly. Also, we avoid problems with
+ * trying to locate the timezone files too early in initialization.)
*/
pg_timezone_initialize();
/*
+ * Likewise, init timezone_abbreviations if not already set.
+ */
+ pg_timezone_abbrev_initialize();
+
+ /*
* Initialize SSL library, if specified.
*/
#ifdef USE_SSL
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 0c50ff38a5a..1f8cda61b34 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.492 2006/07/14 14:52:23 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.493 2006/07/29 03:02:56 tgl Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
@@ -2758,6 +2758,8 @@ PostgresMain(int argc, char *argv[], const char *username)
proc_exit(1);
/* If timezone is not set, determine what the OS uses */
pg_timezone_initialize();
+ /* If timezone_abbreviations is not set, select default */
+ pg_timezone_abbrev_initialize();
}
if (PostAuthDelay)
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 5791e63d87b..64723ba45d4 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.332 2006/07/27 08:30:41 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.333 2006/07/29 03:02:56 tgl Exp $
*
*--------------------------------------------------------------------
*/
@@ -221,10 +221,10 @@ static char *regex_flavor_string;
static char *server_encoding_string;
static char *server_version_string;
static char *timezone_string;
+static char *timezone_abbreviations_string;
static char *XactIsoLevel_string;
static char *data_directory;
static char *custom_variable_classes;
-static char *timezone_abbreviations;
static int max_function_args;
static int max_index_keys;
static int max_identifier_length;
@@ -2101,8 +2101,8 @@ static struct config_string ConfigureNamesString[] =
gettext_noop("Selects a file of timezone abbreviations"),
NULL,
},
- &timezone_abbreviations,
- "Default", assign_timezone_abbreviations, NULL
+ &timezone_abbreviations_string,
+ "UNKNOWN", assign_timezone_abbreviations, NULL
},
{
@@ -6288,9 +6288,27 @@ assign_backslash_quote(const char *newval, bool doit, GucSource source)
static const char *
assign_timezone_abbreviations(const char *newval, bool doit, GucSource source)
{
+ /*
+ * The powerup value shown above for timezone_abbreviations is "UNKNOWN".
+ * When we see this we just do nothing. If this value isn't overridden
+ * from the config file then pg_timezone_abbrev_initialize() will
+ * eventually replace it with "Default". This hack has two purposes:
+ * to avoid wasting cycles loading values that might soon be overridden
+ * from the config file, and to avoid trying to read the timezone abbrev
+ * files during InitializeGUCOptions(). The latter doesn't work in an
+ * EXEC_BACKEND subprocess because my_exec_path hasn't been set yet and
+ * so we can't locate PGSHAREDIR. (Essentially the same hack is used
+ * to delay initializing TimeZone ... if we have any more, we should
+ * try to clean up and centralize this mechanism ...)
+ */
+ if (strcmp(newval, "UNKNOWN") == 0)
+ {
+ return newval;
+ }
+
/* Loading abbrev file is expensive, so only do it when value changes */
- if (timezone_abbreviations == NULL ||
- strcmp(timezone_abbreviations, newval) != 0)
+ if (timezone_abbreviations_string == NULL ||
+ strcmp(timezone_abbreviations_string, newval) != 0)
{
int elevel;
@@ -6309,6 +6327,22 @@ assign_timezone_abbreviations(const char *newval, bool doit, GucSource source)
return newval;
}
+/*
+ * pg_timezone_abbrev_initialize --- set default value if not done already
+ *
+ * This is called after initial loading of postgresql.conf. If no
+ * timezone_abbreviations setting was found therein, select default.
+ */
+void
+pg_timezone_abbrev_initialize(void)
+{
+ if (strcmp(timezone_abbreviations_string, "UNKNOWN") == 0)
+ {
+ SetConfigOption("timezone_abbreviations", "Default",
+ PGC_POSTMASTER, PGC_S_ARGV);
+ }
+}
+
static bool
assign_tcp_keepalives_idle(int newval, bool doit, GucSource source)
{
diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h
index f8938d9433a..3c2ebe2ac4d 100644
--- a/src/include/utils/guc.h
+++ b/src/include/utils/guc.h
@@ -7,7 +7,7 @@
* Copyright (c) 2000-2006, PostgreSQL Global Development Group
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
- * $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.70 2006/07/25 03:51:22 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.71 2006/07/29 03:02:56 tgl Exp $
*--------------------------------------------------------------------
*/
#ifndef GUC_H
@@ -208,6 +208,8 @@ extern void ProcessGUCArray(ArrayType *array, GucSource source);
extern ArrayType *GUCArrayAdd(ArrayType *array, const char *name, const char *value);
extern ArrayType *GUCArrayDelete(ArrayType *array, const char *name);
+extern void pg_timezone_abbrev_initialize(void);
+
#ifdef EXEC_BACKEND
extern void write_nondefault_variables(GucContext context);
extern void read_nondefault_variables(void);