Strange behavior on plpgsql trigger function in if comparison - Mailing list pgsql-hackers

From Omar Bettin
Subject Strange behavior on plpgsql trigger function in if comparison
Date
Msg-id 1CA201535BF04DB69CAFAB9D9CAF6A4D@Project
Whole thread Raw
Responses Re: Strange behavior on plpgsql trigger function in if comparison  (Stefan Kaltenbrunner <stefan@kaltenbrunner.cc>)
Re: Strange behavior on plpgsql trigger function in if comparison  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
Hi,
 
I have to compare an OLD.Value with a NEW.Value on PostgreSQL 8.2.4 plpgsql trigger function:
 
IF OLD.Value <> NEW.Value THEN
...
 
but, if OLD.Value IS NULL and NOT NEW.Value IS NULL the previous IF does not work and I have to use this method:
 
IF (OLD.Value <> NEW.Value) OR (OLD.Value IS NULL  AND NOT NEW.Value IS NULL) THEN
...
 
this works!
Is that normal ?
 
Thank you
 
Omar Bettin

pgsql-hackers by date:

Previous
From: Decibel!
Date:
Subject: Re: Truncate Triggers
Next
From: Stefan Kaltenbrunner
Date:
Subject: Re: Strange behavior on plpgsql trigger function in if comparison