Skip site navigation (1) Skip section navigation (2)

Re: char field <> or != to a value does not select where field is null ???

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Douglas Toltzman <doug(at)oakstreetsoftware(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: char field <> or != to a value does not select where field is null ???
Date: 2005-09-22 17:38:17
Message-ID: 1293.1127410697@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
Douglas Toltzman <doug(at)oakstreetsoftware(dot)com> writes:
> It was my understanding that a NULL value would be not-equal to any 
> non-null value.  Am I wrong about this?

Yes.  A NULL is neither equal nor unequal to anything else.

You can use IS DISTINCT FROM to get the behavior you are looking for,
but it might be better to rethink how you are using NULL.

			regards, tom lane

In response to

pgsql-bugs by date

Next:From: Bruce MomjianDate: 2005-09-23 02:13:30
Subject: Re: BUG #1883: Renaming a schema leaves inconsistent sequence
Previous:From: Douglas ToltzmanDate: 2005-09-22 17:29:05
Subject: char field <> or != to a value does not select where field is null ???

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group