Re: not null - trivial, unexpected behavior

From: Rene Pijlman <reageer(dot)in(at)de(dot)nieuwsgroep>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: not null - trivial, unexpected behavior
Date: 2001-06-16 15:28:06
Message-ID: odumit8vqilkh2l9kfiljlj88oa0e4e2fk@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

jmscott(at)yahoo(dot)com (John Scott) schreef:
>select count(*) from A where b = null; /* Returns 1, ok */
>select count(*) from A where b != null; /* Returns 0 ... not ok! */
>
>What am i missing?

The documentation :-)

"To check whether a value is or is not NULL, use the constructs

expression IS NULL
expression IS NOT NULL

Do not use expression = NULL because NULL is not "equal to" NULL.
(NULL represents an unknown value, so it is not known whether two
unknown values are equal.) Postgres presently converts x = NULL
clauses to x IS NULL to allow some broken client applications (such as
Microsoft Access) to work, but this may be discontinued in a future
release."

http://www.postgresql.org/users-lounge/docs/7.1/postgres/functions-comparison.html

Regards,
René Pijlman
http://www.applinet.nl

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Peter Eisentraut 2001-06-16 16:11:54 Re: not null - trivial, unexpected behavior
Previous Message John Scott 2001-06-16 15:16:11 not null - trivial, unexpected behavior