Simplify handling of the timezone GUC by making initdb choose the default.
Tom Lane <tgl@sss.pgh.pa.us>
Simplify handling of the timezone GUC by making initdb choose the default. We were doing some amazingly complicated things in order to avoid running the very expensive identify_system_timezone() procedure during GUC initialization. But there is an obvious fix for that, which is to do it once during initdb and have initdb install the system-specific default into postgresql.conf, as it already does for most other GUC variables that need system-environment-dependent defaults. This means that the timezone (and log_timezone) settings no longer have any magic behavior in the server. Per discussion.
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/config.sgml | modified | +8 −6 |
| doc/src/sgml/datatype.sgml | modified | +2 −19 |
| doc/src/sgml/ref/set.sgml | modified | +1 −3 |
| src/backend/bootstrap/bootstrap.c | modified | +0 −4 |
| src/backend/commands/variable.c | modified | +3 −40 |
| src/backend/postmaster/postmaster.c | modified | +0 −15 |
| src/backend/tcop/postgres.c | modified | +0 −4 |
| src/backend/utils/error/elog.c | modified | +9 −20 |
| src/backend/utils/misc/guc.c | modified | +17 −4 |
| src/backend/utils/misc/guc-file.l | modified | +0 −1 |
| src/backend/utils/misc/postgresql.conf.sample | modified | +2 −2 |
| src/bin/initdb/findtimezone.c | added | +1224 −0 |
| src/bin/initdb/.gitignore | modified | +1 −0 |
| src/bin/initdb/initdb.c | modified | +16 −9 |
| src/bin/initdb/Makefile | modified | +8 −3 |
| src/include/pgtime.h | modified | +13 −10 |
| src/include/utils/guc.h | modified | +0 −2 |
| src/timezone/localtime.c | modified | +28 −0 |
| src/timezone/pgtz.c | modified | +40 −1225 |