Re: overlaps() does not work as expected?

From: Jochem van Dieten <jochemd(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: overlaps() does not work as expected?
Date: 2005-05-27 18:28:11
Message-ID: f96a9b830505271128493412f2@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 5/27/05, Mario Weilguni wrote:
> I've quite some trouble with the overlaps function:
> SELECT overlaps('9.6.2005'::date, '9.6.2005'::date, '9.6.2005'::date,
> '9.6.2005'::date);
> returns true (these are german timestamps dd.mm.yyyy)
>
> SELECT overlaps('8.6.2005'::date, '9.6.2005'::date, '9.6.2005'::date,
> '9.6.2005'::date);
> returns false
>
> Is this a bug or a (quite strange) feature?

It is consistent with the SQL standard:
<quote>
<overlaps predicate> uses the operator OVERLAPS to determine whether
or not two chronological periods overlap in time. A chronological
period is specified aither as a pair of datetimes (starting and
ending) or as a starting datetime and an interval. If the length of
the period is greater than 0 (zero), then the period consists of all
points of time greater than or equal to the lower endpoint, and less
than the upper endpoint. If the length of the period is equal to 0
(zero), then the period consists of a single point in time, the lower
endpoint. Two periods overlap if they have at least one point in
common.
</quote> ISO/IEC 9075-2:2003 4.6 Datetimes and intervals.

For those who prefer BNF look at 8.13 <overlaps predicate> in said standard.

Jochem

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2005-05-27 18:34:31 OSCON field trip, Friday afternoon
Previous Message Alvaro Herrera 2005-05-27 18:10:36 Re: overlaps() does not work as expected?