From: | Andreas Joseph Krogh <andreak(at)officenet(dot)no> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Why is NULL = unbounded for rangetypes? |
Date: | 2013-07-09 08:45:34 |
Message-ID: | OrigoEmail.bf5.ac6ff6ffeb116aec.13fc29939e0@prod2 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
<div>På mandag 08. juli 2013 kl. 19:16:15, skrev Jeff Davis <<a href="mailto:pgsql(at)j-davis(dot)com" target="_blank">pgsql(at)j-davis(dot)com</a>>:</div>
<blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style="display:inline; font-family: monospace; font-size: 12px;">On Mon, 2013-07-08 at 10:19 +0200, Andreas Joseph Krogh wrote:<br>
> Hi.<br>
> <br>
> Both of these queries return TRUE because NULL means "unmounded":<br>
> select daterange('2013-07-01' :: DATE, null, '[]') && daterange('2013-07-04' :: DATE, '2013-07-30' :: DATE, '[]');<br>
> select daterange(null, '2013-08-11' :: DATE, '[]') && daterange('2013-07-04' :: DATE, '2013-07-30' :: DATE, '[]');<br>
> What is the rational behind this behavior of NULL?<br>
<br>
It's just a convenience that passing NULL to a constructor creates an<br>
unbounded range. The alternatives of having extra constructors for<br>
unbounded ranges were discussed, but seemed more awkward.<br>
<br>
Note that ranges do not allow either bound to be NULL. That would create<br>
a lot of semantic problems.<br>
<br>
Does that answer your question?</div>
</blockquote>
<div> </div>
<div>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").</div>
<div> </div>
<div class="origo-email-signature">--<br>
Andreas Joseph Krogh <andreak(at)officenet(dot)no> mob: +47 909 56 963<br>
Senior Software Developer / CTO - OfficeNet AS - http://www.officenet.no<br>
Public key: http://home.officenet.no/~andreak/public_key.asc</div>
<div> </div>
Attachment | Content-Type | Size |
---|---|---|
unknown_filename | text/html | 1.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | itishree sukla | 2013-07-09 09:26:09 | Support for Foreign keys with arrays |
Previous Message | Misa Simic | 2013-07-09 08:15:45 | Re: Longest Common Subsequence in Postgres - Algorithm Challenge |