Search Postgresql Archives

Re: NULL != text ?

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

 



Alban Hertroys <alban@xxxxxxxxxxxxxxxxx> 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

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

[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