NULL != text ?

From: CSN <cool_screen_name90001(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: NULL != text ?
Date: 2005-10-20 06:04:36
Message-ID: 20051020060437.21214.qmail@web52904.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I was trying this:

IF (OLD.value != NEW.value) THEN
--
END IF;

and couldn't get the condition to evaluate to true at
all if OLD.value was NULL. I also tried:

IF (OLD.value NOT LIKE NEW.value) THEN
--
END IF;

with the same result. But this works:

IF ((OLD.value is NULL and NEW.value is NOT NULL) or
(OLD.value != NEW.value)) THEN
--
END IF;

So, does NULL != 'abc' always evaluate to false? The
manual
(http://www.postgresql.org/docs/8.0/interactive/functions-comparison.html)
states don't compare NULL values using =, but nothing
about using !=

CSN


__________________________________
Yahoo! Music Unlimited
Access over 1 million songs. Try it free.
http://music.yahoo.com/unlimited/

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Stark 2005-10-20 06:17:13 Re: [HACKERS] 'a' == 'a '
Previous Message Dean Gibson (DB Administrator) 2005-10-20 05:50:51 PSQL suggested enhancement