Re: Why overlaps is not working

From: Jorge Godoy <jgodoy(at)gmail(dot)com>
To: "Andrus" <eetasoft(at)online(dot)ee>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Why overlaps is not working
Date: 2006-11-09 17:14:13
Message-ID: 87velo1r16.fsf@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Andrus" <eetasoft(at)online(dot)ee> writes:

>> Why not just subtract/add 1, so that the check includes the boundary
>> dates?
>>
>> Like so;
>> select 1 where ('2006-10-31'::date -1, '9999-12-31'::date +1) OVERLAPS
>> ('2006-10-16'::DATE -1, '2006-10-31':: DATE +1)
>
> Alban,
>
> thank you. I use only dates as OVERLAPS arguments.
> I changed all my WHERE clauses from
>
> WHERE (a,b) OVERLAPS (c,d)
>
> to
>
> WHERE (a-1,b+1) OVERLAPS (c-1,d+1)
>
> Will this give correct results ?

It might give you false positives...

2006-11-30 -- 2006-12-05 AND 2006-12-06 -- 2006-12-15 (original) -- FALSE
2006-11-29 -- 2006-12-06 AND 2006-12-05 -- 2006-12-16 (changed) -- TRUE

Be seeing you,
--
Jorge Godoy <jgodoy(at)gmail(dot)com>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2006-11-09 17:15:37 Re: Mac OS X
Previous Message Enrico 2006-11-09 17:12:08 Datum problem