Strange behavior on plpgsql trigger function in if comparison

From: "Omar Bettin" <o(dot)bettin(at)tiscali(dot)it>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: Strange behavior on plpgsql trigger function in if comparison
Date: 2008-02-02 11:26:50
Message-ID: 1CA201535BF04DB69CAFAB9D9CAF6A4D@Project
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stefan Kaltenbrunner 2008-02-02 11:50:04 Re: Strange behavior on plpgsql trigger function in if comparison
Previous Message Decibel! 2008-02-02 04:16:49 Re: Truncate Triggers