* 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 $
*
*-------------------------------------------------------------------------
*/
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 */
*
*
* 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
*
* 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.
*/
* 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 $
*
*--------------------------------------------------------------------
*/
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;
gettext_noop("Selects a file of timezone abbreviations"),
NULL,
},
- &timezone_abbreviations,
- "Default", assign_timezone_abbreviations, NULL
+ &timezone_abbreviations_string,
+ "UNKNOWN", assign_timezone_abbreviations, NULL
},
{
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;
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)
{
* 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
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);