Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e893e87

Browse files
committed
Update timezone documentation to reflect current reality: instead of
giving tables of known timezone names, refer the user to the system views. Joachim Wieland
1 parent 9adb2c4 commit e893e87

File tree

4 files changed

+100
-1865
lines changed

4 files changed

+100
-1865
lines changed

doc/src/sgml/datatype.sgml

Lines changed: 83 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.175 2006/09/16 16:18:11 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.176 2006/09/22 16:20:00 tgl Exp $ -->
22

33
<chapter id="datatype">
44
<title id="datatype-title">Data Types</title>
@@ -1706,8 +1706,8 @@ SELECT b, char_length(b) FROM test2;
17061706
</table>
17071707

17081708
<para>
1709-
Refer to <xref linkend="datetime-appendix"> for a list of
1710-
time zone names that are recognized for input.
1709+
Refer to <xref linkend="datatype-timezones"> for more information on how
1710+
to specify time zones.
17111711
</para>
17121712
</sect3>
17131713

@@ -2151,6 +2151,83 @@ January 8 04:05:06 1999 PST
21512151
parameter before being displayed to the client.
21522152
</para>
21532153

2154+
<para>
2155+
<productname>PostgreSQL</productname> allows you to specify time zones in
2156+
three different forms:
2157+
<itemizedlist>
2158+
<listitem>
2159+
<para>
2160+
A full time zone name, for example <literal>America/New_York</>.
2161+
The recognized time zone names are listed in the
2162+
<literal>pg_timezone_names</literal> view (see <xref
2163+
linkend="view-pg-timezone-names">).
2164+
<productname>PostgreSQL</productname> uses the widely-used
2165+
<literal>zic</> time zone data for this purpose, so the same
2166+
names are also recognized by much other software.
2167+
</para>
2168+
</listitem>
2169+
<listitem>
2170+
<para>
2171+
A time zone abbreviation, for example <literal>PST</>. Such a
2172+
specification merely defines a particular offset from UTC, in
2173+
contrast to full time zone names which may imply a set of daylight
2174+
savings transition-date rules as well. The recognized abbreviations
2175+
are listed in the <literal>pg_timezone_abbrevs</> view (see <xref
2176+
linkend="view-pg-timezone-abbrevs">). You cannot set the
2177+
configuration parameter <xref linkend="guc-timezone"> using a time
2178+
zone abbreviation, but you can use abbreviations in
2179+
date/time input values and with the <literal>AT TIME ZONE</>
2180+
operator.
2181+
</para>
2182+
</listitem>
2183+
<listitem>
2184+
<para>
2185+
In addition to the timezone names and abbreviations,
2186+
<productname>PostgreSQL</productname> will accept time zone
2187+
specifications of the form <replaceable>STD</><replaceable>offset</> or
2188+
<replaceable>STD</><replaceable>offset</><replaceable>DST</>, where
2189+
<replaceable>STD</> is a zone abbreviation, <replaceable>offset</> is a
2190+
numeric offset in hours west from UTC, and <replaceable>DST</> is an
2191+
optional daylight-savings zone abbreviation, assumed to stand for one
2192+
hour ahead of the given offset. For example, if <literal>EST5EDT</>
2193+
were not already a recognized zone name, it would be accepted and would
2194+
be functionally equivalent to USA East Coast time. When a
2195+
daylight-savings zone name is present, it is assumed to be used
2196+
according to USA time zone rules, so this feature is of limited use
2197+
outside North America. One should also be wary that this provision can
2198+
lead to silently accepting bogus input, since there is no check on the
2199+
reasonableness of the zone abbreviations. For example, <literal>SET
2200+
TIMEZONE TO FOOBAR0</> will work, leaving the system effectively using
2201+
a rather peculiar abbreviation for GMT.
2202+
</para>
2203+
</listitem>
2204+
</itemizedlist>
2205+
2206+
There is a conceptual and practical difference between the abbreviations
2207+
and the full names: abbreviations always represent a fixed offset from
2208+
UTC, whereas most of the full names imply a local daylight-savings time
2209+
rule and so have two possible UTC offsets. That's why you always have to
2210+
specify a date if you want to use full time zone names in <type>timetz</>
2211+
values. This is also the reason why you should set <xref
2212+
linkend="guc-timezone"> to a full time zone name: this way,
2213+
<productname>PostgreSQL</productname>
2214+
will always know the correct UTC offset for your region.
2215+
</para>
2216+
2217+
<para>
2218+
Note that timezone names are <emphasis>not</> used for date/time output
2219+
&mdash; all supported output formats use numeric timezone displays to
2220+
avoid ambiguity.
2221+
</para>
2222+
2223+
<para>
2224+
Neither full names nor abbreviations are hard-wired into the server;
2225+
they are obtained from configuration files stored under
2226+
<filename>.../share/timezone/</> and <filename>.../share/timezonesets/</>
2227+
of the installation directory
2228+
(see <xref linkend="datetime-config-files">).
2229+
</para>
2230+
21542231
<para>
21552232
The <xref linkend="guc-timezone"> configuration parameter can
21562233
be set in the file <filename>postgresql.conf</>, or in any of the
@@ -2191,12 +2268,6 @@ January 8 04:05:06 1999 PST
21912268
</listitem>
21922269
</itemizedlist>
21932270
</para>
2194-
2195-
<para>
2196-
Refer to <xref linkend="datetime-appendix"> for a list of
2197-
available time zones.
2198-
</para>
2199-
22002271
</sect2>
22012272

22022273
<sect2 id="datatype-datetime-internals">
@@ -3424,10 +3495,9 @@ SELECT * FROM pg_attribute
34243495
<listitem>
34253496

34263497
<para>
3427-
Missing features include XQuery, SQL/XML syntax (ISO/IEC
3428-
9075-14), and an <acronym>XML</> data type optimized for
3429-
<acronym>XML</> storage.
3430-
3498+
Missing features include XQuery, SQL/XML syntax (ISO/IEC
3499+
9075-14), and an <acronym>XML</> data type optimized for
3500+
<acronym>XML</> storage.
34313501
</para>
34323502
</listitem>
34333503
</varlistentry>

0 commit comments

Comments
 (0)