aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2009-12-18 18:45:50 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2009-12-18 18:45:50 +0000
commitbe3a24de196ba81d30e134829412476e200cb228 (patch)
treea86fb508caf8b11de27fefb9df4ed8d9c6249074
parentf5fd651e1b96db6fa89ae540214e180ecf36a547 (diff)
downloadpostgresql-be3a24de196ba81d30e134829412476e200cb228.tar.gz
postgresql-be3a24de196ba81d30e134829412476e200cb228.zip
Force the TZ environment variable to be set during initdb. This is to
short-circuit the rather expensive identify_system_timezone() procedure, which we have no real need for during initdb since nothing done here depends on the timezone setting. Since we launch quite a few standalone backends during the initdb sequence, this adds up to a significant savings, and seems worth doing to save developer time even though it will hardly matter to end users. Per my report today on pgsql-hackers.
-rw-r--r--src/bin/initdb/initdb.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 6f1f211c141..d7cf1a44333 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -42,7 +42,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions taken from FreeBSD.
*
- * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.178 2009/12/11 03:34:56 itagaki Exp $
+ * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.179 2009/12/18 18:45:50 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -2712,6 +2712,14 @@ main(int argc, char *argv[])
sprintf(pgdenv, "PGDATA=%s", pg_data);
putenv(pgdenv);
+ /*
+ * Also ensure that TZ is set, so that we don't waste time identifying the
+ * system timezone each of the many times we start a standalone backend.
+ * It's okay to use a hard-wired value here because nothing done during
+ * initdb cares about the timezone setting.
+ */
+ putenv("TZ=GMT");
+
if ((ret = find_other_exec(argv[0], "postgres", PG_BACKEND_VERSIONSTR,
backend_exec)) < 0)
{