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 $ -->
2
2
3
3
<chapter id="functions">
4
4
<title>Functions and Operators</title>
@@ -6155,7 +6155,15 @@ SELECT SUBSTRING('XY1234Z', 'Y*?([0-9]{1,3})');
6155
6155
This expression yields true when two time periods (defined by their
6156
6156
endpoints) overlap, false when they do not overlap. The endpoints
6157
6157
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.
6159
6167
</para>
6160
6168
6161
6169
<screen>
@@ -6165,6 +6173,12 @@ SELECT (DATE '2001-02-16', DATE '2001-12-21') OVERLAPS
6165
6173
SELECT (DATE '2001-02-16', INTERVAL '100 days') OVERLAPS
6166
6174
(DATE '2001-10-30', DATE '2002-10-30');
6167
6175
<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>
6168
6182
</screen>
6169
6183
6170
6184
<para>
0 commit comments