Skip to content

Commit 9f6ad2f

Browse files
committed
Doc: clarify behavior of timestamptz input some more.
Try to make it absolutely plain that we don't retain the originally specified time zone, only the UTC timestamp. While at it, make glossary entries for "UTC" and "GMT". Author: Robert Treat <rob@xzilla.net> Co-authored-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/173796426022.1064.9135167366862649513@wrigleys.postgresql.org Backpatch-through: 13
1 parent ceeae76 commit 9f6ad2f

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

doc/src/sgml/datatype.sgml

+10-7
Original file line numberDiff line numberDiff line change
@@ -2184,24 +2184,27 @@ TIMESTAMP '2004-10-19 10:23:54+02'
21842184
<programlisting>
21852185
TIMESTAMP WITH TIME ZONE '2004-10-19 10:23:54+02'
21862186
</programlisting>
2187+
</para>
21872188

2188-
In a literal that has been determined to be <type>timestamp without time
2189+
<para>
2190+
In a value that has been determined to be <type>timestamp without time
21892191
zone</type>, <productname>PostgreSQL</productname> will silently ignore
21902192
any time zone indication.
21912193
That is, the resulting value is derived from the date/time
2192-
fields in the input value, and is not adjusted for time zone.
2194+
fields in the input string, and is not adjusted for time zone.
21932195
</para>
21942196

21952197
<para>
2196-
For <type>timestamp with time zone</type>, the internally stored
2197-
value is always in UTC (Universal
2198-
Coordinated Time, traditionally known as Greenwich Mean Time,
2199-
<acronym>GMT</acronym>). An input value that has an explicit
2200-
time zone specified is converted to UTC using the appropriate offset
2198+
For <type>timestamp with time zone</type> values, an input string
2199+
that includes an explicit time zone will be converted to UTC
2200+
(<glossterm linkend="glossary-utc">Universal Coordinated
2201+
Time</glossterm>) using the appropriate offset
22012202
for that time zone. If no time zone is stated in the input string,
22022203
then it is assumed to be in the time zone indicated by the system's
22032204
<xref linkend="guc-timezone"/> parameter, and is converted to UTC using the
22042205
offset for the <varname>timezone</varname> zone.
2206+
In either case, the value is stored internally as UTC, and the
2207+
originally stated or assumed time zone is not retained.
22052208
</para>
22062209

22072210
<para>

doc/src/sgml/glossary.sgml

+16
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,11 @@
687687
</glossdef>
688688
</glossentry>
689689

690+
<glossentry>
691+
<glossterm>GMT</glossterm>
692+
<glosssee otherterm="glossary-utc" />
693+
</glossentry>
694+
690695
<glossentry id="glossary-grant">
691696
<glossterm>Grant</glossterm>
692697
<glossdef>
@@ -1782,6 +1787,17 @@
17821787
</glossdef>
17831788
</glossentry>
17841789

1790+
<glossentry id="glossary-utc">
1791+
<glossterm>UTC</glossterm>
1792+
<glossdef>
1793+
<para>
1794+
Universal Coordinated Time, the primary global time reference,
1795+
approximately the time prevailing at the zero meridian of longitude.
1796+
Often but inaccurately referred to as GMT (Greenwich Mean Time).
1797+
</para>
1798+
</glossdef>
1799+
</glossentry>
1800+
17851801
<glossentry id="glossary-vacuum">
17861802
<glossterm>Vacuum</glossterm>
17871803
<glossdef>

0 commit comments

Comments
 (0)