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><=</>
6163+ <replaceable>time</> <literal><</> <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
61656173SELECT (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>