Skip to content

Commit 7fe23c8

Browse files
committed
Doc: spell out comparison behaviors for the date/time types.
The behavior of cross-type comparisons among date/time data types was not really explained anywhere. You could probably infer it if you recognized the applicability of comments elsewhere about datatype conversions, but it seems worthy of explicit documentation. Per bug #16797 from Dana Burd. Discussion: https://postgr.es/m/16797-f264b0b980b53b8b@postgresql.org
1 parent d46eb10 commit 7fe23c8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

doc/src/sgml/func.sgml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6459,6 +6459,21 @@ SELECT regexp_matches('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
64596459
linkend="datatype-datetime">.
64606460
</para>
64616461

6462+
<para>
6463+
In addition, the usual comparison operators shown in
6464+
<xref linkend="functions-comparison-table"> are available for the
6465+
date/time types. Dates and timestamps (with or without time zone) are
6466+
all comparable, while times (with or without time zone) and intervals
6467+
can only be compared to other values of the same data type. When
6468+
comparing a timestamp without time zone to a timestamp with time zone,
6469+
the former value is assumed to be given in the time zone specified by
6470+
the <xref linkend="guc-timezone"> configuration parameter, and is
6471+
rotated to UTC for comparison to the latter value (which is already
6472+
in UTC internally). Similarly, a date value is assumed to represent
6473+
midnight in the <varname>TimeZone</varname> zone when comparing it
6474+
to a timestamp.
6475+
</para>
6476+
64626477
<para>
64636478
All the functions and operators described below that take <type>time</type> or <type>timestamp</type>
64646479
inputs actually come in two variants: one that takes <type>time with time zone</type> or <type>timestamp

0 commit comments

Comments
 (0)