Received: from postgresql.org.org (webmail.postgresql.org [216.126.85.28]) by postgresql.org (8.11.3/8.11.1) with SMTP id f5KHV3a16666 for ; Wed, 20 Jun 2001 13:31:03 -0400 (EDT) (envelope-from pgsql-sql-owner@postgresql.org) Received: from news.tht.net (news.hub.org [216.126.91.242]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f5GFVPa68205 for ; Sat, 16 Jun 2001 11:31:25 -0400 (EDT) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.4/8.11.4) id f5GFREB37569 for pgsql-sql@postgresql.org; Sat, 16 Jun 2001 11:27:14 -0400 (EDT) (envelope-from news) From: Rene Pijlman X-Newsgroups: comp.databases.postgresql.sql Subject: Re: not null - trivial, unexpected behavior Date: Sat, 16 Jun 2001 17:28:06 +0200 Organization: XS4ALL Internet BV Lines: 25 Message-ID: References: <20010616151611.40654.qmail@web10006.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@xs4all.nl X-Newsreader: Forte Agent 1.7/32.534 To: pgsql-sql@postgresql.org X-Archive-Number: 200106/315 X-Sequence-Number: 3589 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