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

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: BUG #6064: != NULL, <> NULL do not work
Дата
Msg-id 4DFB1C6F020000250003E7D4@gw.wicourts.gov
обсуждение исходный текст
Ответ на BUG #6064: != NULL, <> NULL do not work  ("Michael Pilling" <Michael.Pilling@dsto.defence.gov.au>)
Ответы Re: BUG #6064: != NULL, <> NULL do not work  (Craig Ringer <craig@postnewspapers.com.au>)
Список pgsql-bugs
"Michael Pilling" <Michael.Pilling@dsto.defence.gov.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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Антон Степаненко
Дата:
Сообщение: Re: could not read block XXXXX in file "base/YYYYY/ZZZZZZ": read only 160 of 8192 bytes
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: BUG #6066: [PATCH] Mark more strings as c-format