Re: NULL != text ?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: NULL != text ?
Дата
Msg-id 9351.1129817358@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: NULL != text ?  (Alban Hertroys <alban@magproductions.nl>)
Ответы 3-state logic (was: Re: NULL != text ?)  (Alban Hertroys <alban@magproductions.nl>)
Список pgsql-general
Alban Hertroys <alban@magproductions.nl> writes:
> Michael Glaesemann wrote:
>> if (OLD.value IS NOT NULL and NEW.value IS NOT NULL and OLD.value <>
>> NEW.value) or OLD.value IS NULL or NEW.value IS NULL
>>
>> But that's untested and I have a hard time thinking in three-value  logic.

> For completeness sake; Because of lazy evaluation, that boils down to:

> if (OLD.value IS NULL OR NEW.value IS NULL OR OLD.value <> NEW.value)

> The last part of the expression is only evaluated if both OLD.value and
> NEW.value aren't NULL.

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.

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: NEW in Rule makes another nextval call?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: server , client encoding issue