| From: | Andreas Joseph Krogh <andreak(at)officenet(dot)no> |
|---|---|
| To: | Postgres General <pgsql-general(at)postgresql(dot)org> |
| Subject: | Why is NULL = unbounded for rangetypes? |
| Date: | 2013-07-08 08:19:18 |
| Message-ID: | OrigoEmail.b39.9039764ca71b5d10.13fbd566210@prod2 |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
<div>Hi.</div>
<div> </div>
<div>Both of these queries return TRUE because NULL means "unmounded":</div>
<div>
<style type="text/css"></style>
<pre class="western" style="text-align: left">
<font face="DejaVu Sans Mono"><font color="#000080"><b>select daterange</b></font><font color="#000000">(</font><font color="#008000"><b>'2013-07-01' </b></font><font color="#000000">:: </font><font color="#000080"><b>DATE</b></font><font color="#000000">, </font><font color="#000080"><b>null</b></font><font color="#000000">, </font><font color="#008000"><b>'[]'</b></font><font color="#000000">) && </font><font color="#000080"><b>daterange</b></font><font color="#000000">(</font><font color="#008000"><b>'2013-07-04' </b></font><font color="#000000">:: </font><font color="#000080"><b>DATE</b></font><font color="#000000">, </font><font color="#008000"><b>'2013-07-30' </b></font><font color="#000000">:: </font><font color="#000080"><b>DATE</b></font><font color="#000000">, </font><font color="#008000"><b>'[]'</b></font><font color="#000000">);</font></font>
<font face="DejaVu Sans Mono"><font color="#000080"><b>select daterange</b></font><font color="#000000">(</font><font color="#000080"><b>null</b></font><font color="#000000">, </font><font color="#008000"><b>'2013-08-11' </b></font><font color="#000000">:: </font><font color="#000080"><b>DATE</b></font><font color="#000000">, </font><font color="#008000"><b>'[]'</b></font><font color="#000000">) && </font><font color="#000080"><b>daterange</b></font><font color="#000000">(</font><font color="#008000"><b>'2013-07-04' </b></font><font color="#000000">:: </font><font color="#000080"><b>DATE</b></font><font color="#000000">, </font><font color="#008000"><b>'2013-07-30' </b></font><font color="#000000">:: </font><font color="#000080"><b>DATE</b></font><font color="#000000">, </font><font color="#008000"><b>'[]'</b></font><font color="#000000">);</font></font></pre>
<div>What is the rational behind this behavior of NULL?</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>
| Attachment | Content-Type | Size |
|---|---|---|
| unknown_filename | text/html | 2.3 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jov | 2013-07-08 09:31:19 | backend hangs at sendto() and can't be terminated |
| Previous Message | Kevin Grittner | 2013-07-08 07:42:57 | Re: Efficiency of materialized views refresh in 9.3 |