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

Commit 2944e6e

Browse files
committed
Improve our explanation of the OVERLAPS operator.
Per gripe from Frank van Vugt.
1 parent 98e4005 commit 2944e6e

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

doc/src/sgml/func.sgml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.516 2010/06/03 14:40:42 momjian Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.517 2010/06/05 14:56:36 tgl Exp $ -->
22

33
<chapter id="functions">
44
<title>Functions and Operators</title>
@@ -6155,7 +6155,15 @@ SELECT SUBSTRING('XY1234Z', 'Y*?([0-9]{1,3})');
61556155
This expression yields true when two time periods (defined by their
61566156
endpoints) overlap, false when they do not overlap. The endpoints
61576157
can be specified as pairs of dates, times, or time stamps; or as
6158-
a date, time, or time stamp followed by an interval.
6158+
a date, time, or time stamp followed by an interval. When a pair
6159+
of values is provided, either the start or the end can be written
6160+
first; <literal>OVERLAPS</> automatically takes the earlier value
6161+
of the pair as the start. Each time period is considered to
6162+
represent the half-open interval <replaceable>start</> <literal>&lt;=</>
6163+
<replaceable>time</> <literal>&lt;</> <replaceable>end</>, unless
6164+
<replaceable>start</> and <replaceable>end</> are equal in which case it
6165+
represents that single time instant. This means for instance that two
6166+
time periods with only an endpoint in common do not overlap.
61596167
</para>
61606168

61616169
<screen>
@@ -6165,6 +6173,12 @@ SELECT (DATE '2001-02-16', DATE '2001-12-21') OVERLAPS
61656173
SELECT (DATE '2001-02-16', INTERVAL '100 days') OVERLAPS
61666174
(DATE '2001-10-30', DATE '2002-10-30');
61676175
<lineannotation>Result: </lineannotation><computeroutput>false</computeroutput>
6176+
SELECT (DATE '2001-10-29', DATE '2001-10-30') OVERLAPS
6177+
(DATE '2001-10-30', DATE '2001-10-31');
6178+
<lineannotation>Result: </lineannotation><computeroutput>false</computeroutput>
6179+
SELECT (DATE '2001-10-30', DATE '2001-10-30') OVERLAPS
6180+
(DATE '2001-10-30', DATE '2001-10-31');
6181+
<lineannotation>Result: </lineannotation><computeroutput>true</computeroutput>
61686182
</screen>
61696183

61706184
<para>

0 commit comments

Comments
 (0)