Skip site navigation (1) Skip section navigation (2)

Re: BUG #6124: overlaps

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: Ludek Bouska <ludek(at)bouska(dot)info>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6124: overlaps
Date: 2011-07-20 11:43:12
Message-ID: 20110720114312.GA27337@depesz.com (view raw or flat)
Thread:
Lists: pgsql-bugs
On Wed, Jul 20, 2011 at 06:09:48AM +0000, Ludek Bouska wrote:
> 
> The following bug has been logged online:
> 
> Bug reference:      6124
> Logged by:          Ludek Bouska
> Email address:      ludek(at)bouska(dot)info
> PostgreSQL version: 8.3.7
> Operating system:   FreeBSD 7.2-RELEASE-p3
> Description:        overlaps
> Details: 
> 
> script
> select ('20110720'::date,'20110721'::date) overlaps
> ('20110721'::date,'20110721'::date)
> gives false.
> 
> It is necessary to make it as
> select ('20110720'::date,'20110721'::date+'1 day'::Interval) overlaps
> ('20110721'::date,'20110721'::date)
> for the 20110721 be realy overlapped.

docs clearly state the reason:
http://www.postgresql.org/docs/current/interactive/functions-datetime.html

This expression yields true when two time periods (defined by their
endpoints) overlap, false when they do not overlap. The endpoints can be
specified as pairs of dates, times, or time stamps; or as a date, time, or
time stamp followed by an interval. When a pair of values is provided,
either the start or the end can be written first; OVERLAPS automatically
takes the earlier value of the pair as the start. Each time period is
considered to represent the half-open interval start <= time < end, unless
start and end are equal in which case it represents that single time
instant. This means for instance that two time periods with only an endpoint
in common do not overlap. 

depesz

-- 
The best thing about modern society is how easy it is to avoid contact with it.
                                                             http://depesz.com/

In response to

Responses

pgsql-bugs by date

Next:From: Renzo KottmannDate: 2011-07-20 12:24:32
Subject: Re: Ambiguos OPERATOR items in pg_restore manifest file
Previous:From: Ludek BouskaDate: 2011-07-20 06:09:48
Subject: BUG #6124: overlaps

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group