Re: NULL != text ? - Mailing list pgsql-general

From Alban Hertroys
Subject Re: NULL != text ?
Date
Msg-id 43576D09.9090305@magproductions.nl
Whole thread Raw
In response to Re: NULL != text ?  (Michael Glaesemann <grzm@myrealbox.com>)
Responses Re: NULL != text ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: NULL != text ?  (Jan Wieck <JanWieck@Yahoo.com>)
List pgsql-general
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.

--
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: Janning Vygen
Date:
Subject: doc typo sql-reindex.html psql vs. postgres
Next
From: "surabhi.ahuja"
Date:
Subject: Re: server , client encoding issue