3-state logic (was: Re: NULL != text ?) - Mailing list pgsql-general

From Alban Hertroys
Subject 3-state logic (was: Re: NULL != text ?)
Date
Msg-id 4357B942.3050803@magproductions.nl
Whole thread Raw
In response to Re: NULL != text ?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
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@magproductions.nl

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//

pgsql-general by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: [pgsql-advocacy] Oracle buys Innobase
Next
From: Andrew Sullivan
Date:
Subject: Re: Select all invalid e-mail addresses