Time zone definitions to config files - Mailing list pgsql-patches

From Joachim Wieland
Subject Time zone definitions to config files
Date
Msg-id 0ec410b2771836780922c5c75c2159d1@
Whole thread Raw
Responses Re: Time zone definitions to config files
List pgsql-patches
Here's the patch that generalizes the australian_timezones hack by moving the
compiled-in time zone definitions into a text file. The text file to use is
chosen via a guc.

The patch comes with `template' files and `set' files. The template files
contain all time zones that I could find, i.e. are autogenerated from zic and
later I added other time zones manually like those from the old pgsql source.
The set files are what you can then specify in the configuration. The default
set is called `Default' and should work for like 90% of the world. A guc
parameter called `timezone_abbreviations' specifies which set to load.
Similar

to setting `australian_timezones = true' today, an Australian would set
`timezone_abbreviations = Australia' and the set called `Australia' gets
loaded.  Basically this file includes the default set and overrides the time
zone information from there with the conflicting Australian time zones. This
include/override feature makes it possible to keep the local sets really
small

and to ship almost everything in the default set. There is another set,
`India', that also includes the default set but then defines the `IST' time
zone differently (is defined to Israel time by default).

Sets get installed to share/timezone/tznames/sets/ and templates to
share/timezone/tznames/templates.
Anybody can think of better names?

From a functionality point of view the template files are not necessary, they
just serve as a template to copy and paste from for someone who is missing
time zone definitions. Also you can see which time zone names do collide. I'd
vote for including them anyway into the distribution but other people might
think differently.

The set gets re-read after server start and SIGHUP. If an error occurs during
server start, the start fails. If the error occurs while reading the
definitions after SIGHUP, a warning message is issued and no changes get
applied.


The default set also changes, adds and removes a few time zones:

Changes to time zone entries:

BDST (British Double Summer Time) was not marked as DST, is now
AKST (Alaska Standard Time) was marked as DST, but is no longer
ALMST (Almaty Savings Time) was not marked as DST, is now
FKT (Falkland Islands Time) was -2 hours and is -4 now
GEST/GET (Georgia (Summer) Time) was +5/+4 and is +4/+3 now
    (there was a time zone change in 2004 (-> zic))
IOT (British Indian Ocean Territory (Chagos)) was +5 and is +6 now
    (there was a time zone change in 1996 (-> zic))
KOST (Kosrae Time) was +12 and is now +11
    (there was a time zone change in 1999 (-> see zic))
KRAST/KRAT (Krasnoyarsk (Summer) Time) was +7/+8 and now got corrected to
+8/+7

RET (Reunion Island Time) was marked as DST, but is no longer
SCT (Mahe Island Time) was marked as DST, but is no longer
WAT (West Africa Time) was -1, but is +1 actually



New time zones:

PMST added for consistency, PMDT was already there
UCT - Universal Coordinated Time



Time zones names that get removed:
"(init)" means that the time zone existed already in dt.h and is like 7 years
old. The rationale to be more reluctant to remove other entries is that there
might have been a reason for why they got added.

AHST   - Alaska/Hawaii Standard Time (init)
         http://www.worldtimezone.com/wtz-names/wtz-ahst.html (1967-1983)
AWT    - (unknown)
BT     - Baghdad Time (init)
CAT    - Central Alaska Time
         http://www.worldtimezone.com/wtz-names/wtz-cat.html (until 1967)
CVT    - Christmas Islands Time (is CXT actually)
         found references to Cape Verde Time but with different offset (-)
DNT    - Dansk Normal Tid (init)
FST    - French Summer Time (init)
FWT    - French Winter Time (init)
GST    - Guam Standard Time, Russia zone 9 (init)
HDT    - Hawaii/Alaska Daylight-Saving Time (init)
         http://www.worldtimezone.com/wtz-names/wtz-hdt.html (until 1947)
HMT    - Hellas Mediterranean Time (?) (init)
IDLE   - International Date Line, East (init)
IDLW   - International Date Line, West (init)
IT     - Iran Time (init)
JST    - Japan Standard Time, Russia zone 8 (init)
JT     - Java Time (init)
METDST - Middle Europe Daylight-Saving Time (init)
MEWT   - Middle European Winter Time (init)
MT     - Moluccas Time (init)
NOR    - Norway Standard Time (init)
NT     - Nome Time (init)
SST    - Swedish Summer Time (init)
SWT    - Swedish Winter Time (init)
THAT   - found more references for TAHT
TRUK   - found more references for TRUT
SET    - Seychelles Time (init)
YDT    - Yukon Daylight-Saving Time (init)
YST    - Yukon Standard Time (init)
ZP4    - (init)
ZP5    - (init)
ZP6    - (init)

Does anybody vote against removing one of those time zones?


The patch also adds a system view pg_timezonenames that contains name, offset
and a boolean flag to indicate whether or not this is a daylight saving time
zone.


Review and comments welcome,

Joachim

(sorry if this mail contains stupid line wrapping, I only have webmail
access right now)

Attachment

pgsql-patches by date:

Previous
From: "Magnus Hagander"
Date:
Subject: pg_regress in C
Next
From: Simon Riggs
Date:
Subject: Re: Resurrecting per-page cleaner for btree