Search Postgresql Archives

Re: Why is NULL = unbounded for rangetypes?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



På mandag 08. juli 2013 kl. 19:16:15, skrev Jeff Davis <pgsql@xxxxxxxxxxx>:
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 <andreak@xxxxxxxxxxxx>      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
 

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux