Re: Why overlaps is not working - Mailing list pgsql-general

From A. Kretschmer
Subject Re: Why overlaps is not working
Date
Msg-id 20061109140533.GC27554@a-kretschmer.de
Whole thread Raw
In response to Why overlaps is not working  ("Andrus" <eetasoft@online.ee>)
List pgsql-general
am  Thu, dem 09.11.2006, um 15:46:50 +0200 mailte Andrus folgendes:
> set datestyle to iso,iso;
>
> select 1 where ('2006-10-31'::date, '9999-12-31'::date) OVERLAPS
>    ('2006-10-16'::DATE, '2006-10-31':: DATE)
>
>
> does not return any rows.
>
> Why ?
> How to make overlaps to return correct result?

Because they don't overlaps.

Example:

test=*# select ('2006-10-01'::date, '2006-10-11'::date) OVERLAPS ('2006-10-11'::DATE, '2006-10-20'::DATE);
 overlaps
----------
 f
(1 row)

test=*# select ('2006-10-01'::date, '2006-10-12'::date) OVERLAPS ('2006-10-11'::DATE, '2006-10-20'::DATE);
 overlaps
----------
 t
(1 row)


Your date-range don't overlap, because the 2nd ends '2006-10-31' and the other
begin with '2006-10-31'. And your query can't return anything because the where-condition
returns false.


Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47215,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

pgsql-general by date:

Previous
From: Alban Hertroys
Date:
Subject: Re: Why overlaps is not working
Next
From: "Andrus"
Date:
Subject: Re: Why overlaps is not working