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

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема 3-state logic (was: Re: NULL != text ?)
Дата
Msg-id 4357B942.3050803@magproductions.nl
обсуждение исходный текст
Ответ на Re: NULL != text ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Andrew Sullivan
Дата:
Сообщение: Re: [pgsql-advocacy] Oracle buys Innobase
Следующее
От: Andrew Sullivan
Дата:
Сообщение: Re: Select all invalid e-mail addresses