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

Commit ecc367b

Browse files
author
Thomas G. Lockhart
committed
Mention new AT TIME ZONE feature.
1 parent bc20c41 commit ecc367b

File tree

1 file changed

+40
-19
lines changed

1 file changed

+40
-19
lines changed

doc/src/sgml/datatype.sgml

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.39 2000/11/10 20:13:25 tgl Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.40 2000/11/11 19:50:31 thomas Exp $
33
-->
44

55
<chapter id="datatype">
@@ -1248,29 +1248,34 @@ January 8 04:05:06 1999 PST
12481248
Although the <type>date</type> type
12491249
does not have an associated time zone, the
12501250
<type>time</type> type can or does.
1251+
Time zones in the real world can have no meaning unless
1252+
associated with a date as well as a time
1253+
since the offset may vary through the year with daylight savings
1254+
time boundaries.
12511255
</para>
12521256
</listitem>
12531257

12541258
<listitem>
12551259
<para>
12561260
The default time zone is specified as a constant integer offset
1257-
from GMT/UTC.
1261+
from GMT/UTC. It is not possible to adapt to daylight savings
1262+
time when doing date/time arithmetic across
1263+
<acronym>DST</acronym> boundaries.
12581264
</para>
12591265
</listitem>
12601266

12611267
</itemizedlist>
1262-
1263-
Time zones in the real world can have no meaning unless
1264-
associated with a date as well as a time
1265-
since the offset may vary through the year with daylight savings
1266-
time boundaries.
12671268
</para>
12681269

12691270
<para>
1270-
To address these difficulties, <productname>Postgres</productname>
1271-
associates time zones only with date and time
1272-
types which contain both date and time,
1273-
and assumes local time for any type containing only
1271+
To address these difficulties, we recommend using date/time
1272+
types which contain both date and time when using time zones. We
1273+
recommend <emphasis>not</emphasis> using the SQL92 type TIME
1274+
WITH TIME ZONE (though it is supported by
1275+
<productname>Postgres</productname> for legacy applications and
1276+
for compatibility with other RDBMS implementations).
1277+
<productname>Postgres</productname>
1278+
assumes local time for any type containing only
12741279
date or time. Further, time zone support is derived from
12751280
the underlying operating system
12761281
time zone capabilities, and hence can handle daylight savings time
@@ -1286,8 +1291,8 @@ January 8 04:05:06 1999 PST
12861291
</para>
12871292

12881293
<para>
1289-
All dates and times are stored internally in Universal UTC,
1290-
alternately known as Greenwich Mean Time (GMT).
1294+
All dates and times are stored internally in UTC,
1295+
traditionally known as Greenwich Mean Time (GMT).
12911296
Times are converted to local time on the database server before being
12921297
sent to the client frontend, hence by default are in the server
12931298
time zone.
@@ -1299,7 +1304,7 @@ January 8 04:05:06 1999 PST
12991304
<itemizedlist spacing="compact" mark="bullet">
13001305
<listitem>
13011306
<para>
1302-
The TZ environment variable used by the backend directly
1307+
The TZ environment variable is used by the backend directly
13031308
on postmaster start-up as the default time zone.
13041309
</para>
13051310
</listitem>
@@ -1315,15 +1320,27 @@ January 8 04:05:06 1999 PST
13151320
sets the time zone for the session.
13161321
</para>
13171322
</listitem>
1323+
<listitem>
1324+
<para>
1325+
The <acronym>SQL92</acronym> qualifier on
1326+
<programlisting>
1327+
<replaceable>timestamp</replaceable> AT TIME ZONE '<replaceable>zone</replaceable>'
1328+
</programlisting>
1329+
where <replaceable>zone</replaceable> can be specified as a
1330+
text time zone (e.g. <literal>'PST'</literal>) or as an
1331+
interval (e.g. <literal>INTERVAL '-08:00'</literal>).
1332+
</para>
1333+
</listitem>
13181334
</itemizedlist>
13191335
</para>
13201336

13211337
<para>
1322-
If an invalid time zone is specified,
1323-
the time zone becomes GMT (on most systems anyway).
1324-
</para>
1325-
1326-
<para>
1338+
<note>
1339+
<para>
1340+
If an invalid time zone is specified,
1341+
the time zone becomes GMT (on most systems anyway).
1342+
</para>
1343+
</note>
13271344

13281345
<note>
13291346
<para>
@@ -1889,6 +1906,10 @@ January 8 04:05:06 1999 PST
18891906
</tgroup>
18901907
</table>
18911908
</para>
1909+
</sect2>
1910+
1911+
<sect2 id="inet-type">
1912+
<title><type>inet</type></title>
18921913

18931914
<para>
18941915
The essential difference between <type>inet</type> and <type>cidr</type>

0 commit comments

Comments
 (0)