]> granicus.if.org Git - postgresql/commitdiff
Arrange to install a "posixrules" entry in our timezone database, so that
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 14 Mar 2007 17:38:15 +0000 (17:38 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 14 Mar 2007 17:38:15 +0000 (17:38 +0000)
POSIX-style timezone specs that don't exactly match any database entry will
be treated as having correct USA DST rules.  Also, document that this can
be changed if you want to use some other DST rules with a POSIX zone spec.

We could consider changing localtime.c's TZDEFRULESTRING, but since that
facility can only deal with one DST transition rule, it seems fairly useless
now; might as well just plan to override it using a "posixrules" entry.

Backpatch as far as 8.0.  There isn't much we can do in 7.x ... either your
libc gets it right, or it doesn't.

doc/src/sgml/datatype.sgml
src/timezone/Makefile

index deeba7bc68ce3667f08cecf0e9da8f6f1363c484..029dec3dcd48a9225c0d3db3acb3a82dd3407b77 100644 (file)
@@ -1,4 +1,4 @@
-<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.181.2.1 2007/01/30 22:29:40 momjian Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.181.2.2 2007/03/14 17:38:15 tgl Exp $ -->
 
  <chapter id="datatype">
   <title id="datatype-title">Data Types</title>
@@ -2194,12 +2194,13 @@ January 8 04:05:06 1999 PST
         were not already a recognized zone name, it would be accepted and would
         be functionally equivalent to USA East Coast time.  When a
         daylight-savings zone name is present, it is assumed to be used
-        according to USA time zone rules, so this feature is of limited use
-        outside North America.  One should also be wary that this provision can
-        lead to silently accepting bogus input, since there is no check on the
-        reasonableness of the zone abbreviations.  For example, <literal>SET
-        TIMEZONE TO FOOBAR0</> will work, leaving the system effectively using
-        a rather peculiar abbreviation for GMT.
+        according to the same daylight-savings transition rules used in the
+        <literal>zic</> time zone database's <filename>posixrules</> entry.
+        In a standard <productname>PostgreSQL</productname> installation,
+        <filename>posixrules</> is the same as <literal>US/Eastern</>, so
+        that POSIX-style time zone specifications follow USA daylight-savings
+        rules.  If needed, you can adjust this behavior by replacing the
+        <filename>posixrules</> file.
        </para>
       </listitem>
      </itemizedlist>
@@ -2210,6 +2211,14 @@ January 8 04:05:06 1999 PST
      rule and so have two possible UTC offsets.
     </para>
 
+    <para>
+     One should be wary that the POSIX-style time zone feature can
+     lead to silently accepting bogus input, since there is no check on the
+     reasonableness of the zone abbreviations.  For example, <literal>SET
+     TIMEZONE TO FOOBAR0</> will work, leaving the system effectively using
+     a rather peculiar abbreviation for UTC.
+    </para>
+
     <para>
      In all cases, timezone names are recognized case-insensitively.
      (This is a change from <productname>PostgreSQL</productname> versions
index 69e79b8536ea144c515bd895b3b2494f3909f616..052cad16a4a34488113d74568149e1745816a942 100644 (file)
@@ -4,7 +4,7 @@
 #    Makefile for the timezone library
 
 # IDENTIFICATION
-#    $PostgreSQL: pgsql/src/timezone/Makefile,v 1.24 2006/07/25 03:51:22 tgl Exp $
+#    $PostgreSQL: pgsql/src/timezone/Makefile,v 1.24.2.1 2007/03/14 17:38:15 tgl Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -25,6 +25,10 @@ TZDATA := africa antarctica asia australasia europe northamerica southamerica \
        pacificnew etcetera factory backward systemv solar87 solar88 solar89
 TZDATAFILES := $(TZDATA:%=$(srcdir)/data/%)
 
+# which zone should determine the DST rules (not the specific UTC offset!)
+# for POSIX-style timezone specs
+POSIXRULES = US/Eastern
+
 all: SUBSYS.o submake-libpgport zic
 
 SUBSYS.o: $(OBJS)
@@ -34,7 +38,7 @@ zic: $(ZICOBJS)
        $(CC) $(CFLAGS) $(ZICOBJS) $(LDFLAGS) $(LIBS) -o $@$(X)
 
 install: all installdirs
-       ./zic -d '$(DESTDIR)$(datadir)/timezone' $(TZDATAFILES)
+       ./zic -d '$(DESTDIR)$(datadir)/timezone' -p '$(POSIXRULES)' $(TZDATAFILES)
        $(MAKE) -C tznames $@
 
 installdirs: