Search Postgresql Archives

3-state logic (was: Re: NULL != text ?)

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

 



Tom Lane wrote:
Wrong.  SQL doesn't guarantee lazy evaluation.  The above will work,
but it's because TRUE OR NULL is TRUE, not because anything is promised
about evaluation order.

Learned something new again, then.

I also noticed FALSE OR NULL is NULL, which went against my intuition. I think I understand why:

- TRUE OR "unknown" can only evaluate to TRUE again; "unknown" is not relevant for the operation. - FALSE OR "unknown" remains "unknown", because "unknown" may be TRUE or it may not. If it is, then the result would be TRUE, but if it isn't it would be FALSE, but we don't know...

This 3-state logic can have some interesting results...

--
Alban Hertroys
alban@xxxxxxxxxxxxxxxxx

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
   7500 AK Enschede

//Showing your Vision to the World//

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

              http://archives.postgresql.org

[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