Skip to content

Commit be3a24d

Browse files
committed
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.
1 parent f5fd651 commit be3a24d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/bin/initdb/initdb.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
* Portions Copyright (c) 1994, Regents of the University of California
4343
* Portions taken from FreeBSD.
4444
*
45-
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.178 2009/12/11 03:34:56 itagaki Exp $
45+
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.179 2009/12/18 18:45:50 tgl Exp $
4646
*
4747
*-------------------------------------------------------------------------
4848
*/
@@ -2712,6 +2712,14 @@ main(int argc, char *argv[])
27122712
sprintf(pgdenv, "PGDATA=%s", pg_data);
27132713
putenv(pgdenv);
27142714

2715+
/*
2716+
* Also ensure that TZ is set, so that we don't waste time identifying the
2717+
* system timezone each of the many times we start a standalone backend.
2718+
* It's okay to use a hard-wired value here because nothing done during
2719+
* initdb cares about the timezone setting.
2720+
*/
2721+
putenv("TZ=GMT");
2722+
27152723
if ((ret = find_other_exec(argv[0], "postgres", PG_BACKEND_VERSIONSTR,
27162724
backend_exec)) < 0)
27172725
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy