Re: [GENERAL] Why is NULL = unbounded for rangetypes?

2013-09-01 Thread Jeff Davis
On Fri, 2013-08-30 at 11:22 +0200, Andreas Joseph Krogh wrote:
 But I agree that returning NULL would be OK, then it would be easy to
 catch in queries when starting playing with range-types in queries.
 Having it implicitly mean infinity comes as a surprise, to me at
 least.

Agreed. This was discussed at the time, and the original version of
Range Types experimented with other means of specifying unbounded ranges
in order to avoid this possible confusion.

Unfortunately, everything we tried was awkward one way or another; and
we eventually made the decision to go with greater convenience, even if
it could cause some confusion.

Regards,
Jeff Davis




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


Re: [GENERAL] Why is NULL = unbounded for rangetypes?

2013-08-30 Thread Andreas Joseph Krogh
På fredag 30. august 2013 kl. 03:23:09, skrev Jeff Davis pg...@j-davis.com:


On Tue, 2013-07-09 at 10:45 +0200, Andreas Joseph Krogh wrote:
 I would expect the queries above to return FALSE and have to use
 INFINITY to have them return TRUE. I don't understand what you mean by
 ranges not allowing either bound to be NULL as it seems to be the case
 (as in it works).

Although passing NULL to the constructor works, it does *not* create a
range where one bound is NULL. It actually creates an unbounded range;
that is, a range where one bound is infinite.

NULL semantics are far too confusing to be useful with ranges. For
instance, if ranges did support NULLs; the queries you mention would
have to return NULL, not FALSE.


 

But I agree that returning NULL would be OK, then it would be easy to catch in queries when starting playing with range-types in queries. Having it implicitly mean infinity comes as a surprise, to me at least.

 

But now that I know this it's exactly not a blocker...

 

--
Andreas Joseph Krogh andr...@officenet.no      mob: +47 909 56 963
Senior Software Developer / CTO - OfficeNet AS - http://www.officenet.no
Public key: http://home.officenet.no/~andreak/public_key.asc

 

Re: [GENERAL] Why is NULL = unbounded for rangetypes?

2013-08-29 Thread Jeff Davis
On Tue, 2013-07-09 at 10:45 +0200, Andreas Joseph Krogh wrote:
 I would expect the queries above to return FALSE and have to use
 INFINITY to have them return TRUE. I don't understand what you mean by
 ranges not allowing either bound to be NULL as it seems to be the case
 (as in it works).

Although passing NULL to the constructor works, it does *not* create a
range where one bound is NULL. It actually creates an unbounded range;
that is, a range where one bound is infinite.

NULL semantics are far too confusing to be useful with ranges. For
instance, if ranges did support NULLs; the queries you mention would
have to return NULL, not FALSE.

Regards,
Jeff Davis




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


Re: [GENERAL] Why is NULL = unbounded for rangetypes?

2013-07-09 Thread Andreas Joseph Krogh
På mandag 08. juli 2013 kl. 19:16:15, skrev Jeff Davis pg...@j-davis.com:


On Mon, 2013-07-08 at 10:19 +0200, Andreas Joseph Krogh wrote:
 Hi.
 
 Both of these queries return TRUE because NULL means unmounded:
 select daterange('2013-07-01' :: DATE, null, '[]')  daterange('2013-07-04' :: DATE, '2013-07-30' :: DATE, '[]');
 select daterange(null, '2013-08-11' :: DATE, '[]')  daterange('2013-07-04' :: DATE, '2013-07-30' :: DATE, '[]');
 What is the rational behind this behavior of NULL?

It's just a convenience that passing NULL to a constructor creates an
unbounded range. The alternatives of having extra constructors for
unbounded ranges were discussed, but seemed more awkward.

Note that ranges do not allow either bound to be NULL. That would create
a lot of semantic problems.

Does that answer your question?


 

I would expect the queries above to return FALSE and have to use INFINITY to have them return TRUE. I don't understand what you mean by ranges not allowing either bound to be NULL as it seems to be the case (as in it works).

 

--
Andreas Joseph Krogh andr...@officenet.no      mob: +47 909 56 963
Senior Software Developer / CTO - OfficeNet AS - http://www.officenet.no
Public key: http://home.officenet.no/~andreak/public_key.asc

 

[GENERAL] Why is NULL = unbounded for rangetypes?

2013-07-08 Thread Andreas Joseph Krogh
Hi.

 

Both of these queries return TRUE because NULL means unmounded:




select daterange('2013-07-01' :: DATE, null, '[]')  daterange('2013-07-04' :: DATE, '2013-07-30' :: DATE, '[]');
select daterange(null, '2013-08-11' :: DATE, '[]')  daterange('2013-07-04' :: DATE, '2013-07-30' :: DATE, '[]');

What is the rational behind this behavior of NULL?


 
--
Andreas Joseph Krogh andr...@officenet.no      mob: +47 909 56 963
Senior Software Developer / CTO - OfficeNet AS - http://www.officenet.no
Public key: http://home.officenet.no/~andreak/public_key.asc


Re: [GENERAL] Why is NULL = unbounded for rangetypes?

2013-07-08 Thread Jeff Davis
On Mon, 2013-07-08 at 10:19 +0200, Andreas Joseph Krogh wrote:
 Hi.
  
 Both of these queries return TRUE because NULL means unmounded:
 select daterange('2013-07-01' :: DATE, null, '[]')  daterange('2013-07-04' 
 :: DATE, '2013-07-30' :: DATE, '[]');
 select daterange(null, '2013-08-11' :: DATE, '[]')  daterange('2013-07-04' 
 :: DATE, '2013-07-30' :: DATE, '[]');
 What is the rational behind this behavior of NULL?

It's just a convenience that passing NULL to a constructor creates an
unbounded range. The alternatives of having extra constructors for
unbounded ranges were discussed, but seemed more awkward.

Note that ranges do not allow either bound to be NULL. That would create
a lot of semantic problems.

Does that answer your question?

Regards,
Jeff Davis




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