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

Re: BUG #6064: != NULL, <> NULL do not work

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Michael Pilling" <Michael(dot)Pilling(at)dsto(dot)defence(dot)gov(dot)au>, <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #6064: != NULL, <> NULL do not work
Date: 2011-06-17 14:20:47
Message-ID: 4DFB1C6F020000250003E7D4@gw.wicourts.gov (view raw or flat)
Thread:
Lists: pgsql-bugs
"Michael Pilling" <Michael(dot)Pilling(at)dsto(dot)defence(dot)gov(dot)au> wrote:
 
> A reasonable programmer would expect != NULL, <> NULL and IS NOT
> NULL to be synonyms.
 
Only if that programmer was not aware of the SQL standard and had
not worked much with a standard-conforming database.
 
NULL is conceptually intended to indicate "unknown" or "not
applicable".  If you have a person table with a date_of_birth
column, which contains NULL for a number of rows for which the date
of birth is unknown, can you say that all such people have the same
date of birth?  No; for any such person, the result of comparing
their date of birth to anyone else's (whether or not the other one
is NULL) is UNKNOWN.
 
You might want to read up on IS [NOT] DISTINCT FROM.  In the SQL
language, while NULL is not known to be equal to NULL, you *can* say
that NULL IS NOT DISTINCT FROM NULL.
 
This is most definitely not a bug in the software.  The
documentation does cover it here:
 
http://www.postgresql.org/docs/9.0/interactive/functions-comparison.html
 
Is there something you would add to that?
 
-Kevin

In response to

Responses

pgsql-bugs by date

Next:From: Alvaro HerreraDate: 2011-06-17 14:21:48
Subject: Re: BUG #6066: [PATCH] Mark more strings as c-format
Previous:From: Антон СтепаненкоDate: 2011-06-17 13:51:00
Subject: Re: could not read block XXXXX in file "base/YYYYY/ZZZZZZ": read only 160 of 8192 bytes

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