Thread: 9.2 Beta: intersection of daterange

9.2 Beta: intersection of daterange

From
Brar Piening
Date:
I'm currently doing some tests on range types:

tests=# SELECT int8range(5,15) * int8range(10,20) AS intersection; intersection
-------------- [10,15)
(1 Zeile)


tests=#
tests=# SELECT '[2010-03-15,2010-05-22)'::daterange * 
'[2010-01-04,)'::daterange AS intersection;      intersection
------------------------- [2010-03-15,2010-05-22)
(1 Zeile)


Does the second query trigger a bug or am I misunderstanding something?

I would expect [2010-01-04,2010-05-22) as result.

Regards,

Brar


Re: 9.2 Beta: intersection of daterange

From
Misa Simic
Date:
I think result is ok... 2010-01-04 is not inside first range...

Sent from my Windows Phone
From: Brar Piening
Sent: 16/05/2012 09:53
To: pgsql-hackers
Subject: [HACKERS] 9.2 Beta: intersection of daterange
I'm currently doing some tests on range types:

tests=# SELECT int8range(5,15) * int8range(10,20) AS intersection;
  intersection
--------------
  [10,15)
(1 Zeile)


tests=#
tests=# SELECT '[2010-03-15,2010-05-22)'::daterange *
'[2010-01-04,)'::daterange AS intersection;
       intersection
-------------------------
  [2010-03-15,2010-05-22)
(1 Zeile)


Does the second query trigger a bug or am I misunderstanding something?

I would expect [2010-01-04,2010-05-22) as result.

Regards,

Brar

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Re: 9.2 Beta: intersection of daterange

From
Brar Piening
Date:
Misa Simic wrote:
> I think result is ok... 2010-01-04 is not inside first range...

Staring at my query for five minutes obviously didn't prevent me from 
creating that noise.

I meant to query "SELECT '[2010-03-15,2010-05-22)'::daterange * 
'[2010-04-01,)'::daterange AS intersection;" which gives the expected 
result.

Sorry for the noise!

Regards,

Brar


Re: 9.2 Beta: intersection of daterange

From
Misa Simic
Date:
I think result is ok... 2010-01-04 is not inside first range...

Sent from my Windows Phone
From: Brar Piening
Sent: 16/05/2012 09:53
To: pgsql-hackers
Subject: [HACKERS] 9.2 Beta: intersection of daterange
I'm currently doing some tests on range types:

tests=# SELECT int8range(5,15) * int8range(10,20) AS intersection; intersection
-------------- [10,15)
(1 Zeile)


tests=#
tests=# SELECT '[2010-03-15,2010-05-22)'::daterange *
'[2010-01-04,)'::daterange AS intersection;      intersection
------------------------- [2010-03-15,2010-05-22)
(1 Zeile)


Does the second query trigger a bug or am I misunderstanding something?

I would expect [2010-01-04,2010-05-22) as result.

Regards,

Brar

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: 9.2 Beta: intersection of daterange

From
Josh Berkus
Date:
On 5/16/12 1:40 AM, Brar Piening wrote:
> Misa Simic wrote:
>> I think result is ok... 2010-01-04 is not inside first range...
> 
> Staring at my query for five minutes obviously didn't prevent me from
> creating that noise.
> 
> I meant to query "SELECT '[2010-03-15,2010-05-22)'::daterange *
> '[2010-04-01,)'::daterange AS intersection;" which gives the expected
> result.
> 
> Sorry for the noise!

Thanks for testing!  You've inadvertently done a positive test, which is
a good thing ...


-- 
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com