Re: not null - trivial, unexpected behavior - Mailing list pgsql-sql

From Rene Pijlman
Subject Re: not null - trivial, unexpected behavior
Date
Msg-id odumit8vqilkh2l9kfiljlj88oa0e4e2fk@4ax.com
Whole thread Raw
In response to not null - trivial, unexpected behavior  (John Scott <jmscott@yahoo.com>)
List pgsql-sql
jmscott@yahoo.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


pgsql-sql by date:

Previous
From: Alex Pilosov
Date:
Subject: Re: Re: binary data
Next
From: "Mahesh Guleria"
Date:
Subject: Row Level Locking !!