Skip to content

Commit 022fd99

Browse files
committed
Fix up some problems in handling of zic-style time zone names in datetime
input routines. Remove the former "DecodePosixTimezone" function in favor of letting the zic code handle POSIX-style zone specs (see tzparse()). In particular this means that "PST+3" now means the same as "-03", whereas it used to mean "-11" --- the zone abbreviation is effectively just a noise word in this syntax. Make sure that all named and POSIX-style zone names will be parsed as a single token. Fix long-standing bogosities in printing and input of fractional-hour timezone offsets (since the tzparse() code will accept these, we'd better make 'em work). Also correct an error in the original coding of the zic-zone-name patch: in "timestamp without time zone" input, zone names are supposed to be allowed but ignored, but the coding was such that the zone changed the interpretation anyway.
1 parent d58f09e commit 022fd99

File tree

8 files changed

+214
-300
lines changed

8 files changed

+214
-300
lines changed

doc/src/sgml/datatype.sgml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.177 2006/10/16 19:58:26 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.178 2006/10/17 21:03:20 tgl Exp $ -->
22

33
<chapter id="datatype">
44
<title id="datatype-title">Data Types</title>
@@ -1675,12 +1675,16 @@ SELECT b, char_length(b) FROM test2;
16751675
<tbody>
16761676
<row>
16771677
<entry><literal>PST</literal></entry>
1678-
<entry>Pacific Standard Time</entry>
1678+
<entry>Abbreviation (for Pacific Standard Time)</entry>
16791679
</row>
16801680
<row>
16811681
<entry><literal>America/New_York</literal></entry>
16821682
<entry>Full time zone name</entry>
16831683
</row>
1684+
<row>
1685+
<entry><literal>PST8PDT</literal></entry>
1686+
<entry>POSIX-style time zone specification</entry>
1687+
</row>
16841688
<row>
16851689
<entry><literal>-8:00</literal></entry>
16861690
<entry>ISO-8601 offset for PST</entry>
@@ -2183,7 +2187,7 @@ January 8 04:05:06 1999 PST
21832187
<listitem>
21842188
<para>
21852189
In addition to the timezone names and abbreviations,
2186-
<productname>PostgreSQL</productname> will accept time zone
2190+
<productname>PostgreSQL</productname> will accept POSIX-style time zone
21872191
specifications of the form <replaceable>STD</><replaceable>offset</> or
21882192
<replaceable>STD</><replaceable>offset</><replaceable>DST</>, where
21892193
<replaceable>STD</> is a zone abbreviation, <replaceable>offset</> is a
@@ -2220,12 +2224,6 @@ January 8 04:05:06 1999 PST
22202224
prior to 8.2, which were case-sensitive in some contexts and not others.)
22212225
</para>
22222226

2223-
<para>
2224-
Note that timezone names are <emphasis>not</> used for date/time output
2225-
&mdash; all supported output formats use numeric timezone displays to
2226-
avoid ambiguity.
2227-
</para>
2228-
22292227
<para>
22302228
Neither full names nor abbreviations are hard-wired into the server;
22312229
they are obtained from configuration files stored under

doc/src/sgml/datetime.sgml

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/datetime.sgml,v 2.54 2006/09/22 16:35:55 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/datetime.sgml,v 2.55 2006/10/17 21:03:20 tgl Exp $ -->
22

33
<appendix id="datetime-appendix">
44
<title>Date/Time Support</title>
@@ -46,9 +46,9 @@
4646
<para>
4747
If the numeric token contains a dash (<literal>-</>), slash
4848
(<literal>/</>), or two or more dots (<literal>.</>), this is
49-
a date string which may have a text month. In case of a slash
50-
(<literal>/</>) it can also be a full time zone name like
51-
<literal>America/New_York</>.
49+
a date string which may have a text month. If a date token has
50+
already been seen, it is instead interpreted as a time zone
51+
name (e.g., <literal>America/New_York</>).
5252
</para>
5353
</step>
5454

@@ -64,7 +64,7 @@
6464
<step>
6565
<para>
6666
If the token starts with a plus (<literal>+</>) or minus
67-
(<literal>-</>), then it is either a time zone or a special
67+
(<literal>-</>), then it is either a numeric time zone or a special
6868
field.
6969
</para>
7070
</step>
@@ -73,30 +73,24 @@
7373

7474
<step>
7575
<para>
76-
If the token is a text string, match up with possible strings.
76+
If the token is a text string, match up with possible strings:
7777
</para>
7878

7979
<substeps>
8080
<step>
8181
<para>
82-
Do a binary-search table lookup for the token
83-
as either a special string (e.g., <literal>today</literal>),
84-
day (e.g., <literal>Thursday</literal>),
85-
month (e.g., <literal>January</literal>),
86-
or noise word (e.g., <literal>at</literal>, <literal>on</literal>).
87-
</para>
88-
89-
<para>
90-
Set field values and bit mask for fields.
91-
For example, set year, month, day for <literal>today</literal>,
92-
and additionally hour, minute, second for <literal>now</literal>.
82+
Do a binary-search table lookup for the token as a time zone
83+
abbreviation.
9384
</para>
9485
</step>
9586

9687
<step>
9788
<para>
9889
If not found, do a similar binary-search table lookup to match
99-
the token with a time zone.
90+
the token as either a special string (e.g., <literal>today</literal>),
91+
day (e.g., <literal>Thursday</literal>),
92+
month (e.g., <literal>January</literal>),
93+
or noise word (e.g., <literal>at</literal>, <literal>on</literal>).
10094
</para>
10195
</step>
10296

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