Re: not null - trivial, unexpected behavior

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: not null - trivial, unexpected behavior
Дата
Msg-id Pine.LNX.4.30.0106161807450.755-100000@peter.localdomain
обсуждение исходный текст
Ответ на not null - trivial, unexpected behavior  (John Scott <jmscott@yahoo.com>)
Ответы Re: not null - trivial, unexpected behavior  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-sql
John Scott writes:

> insert into A(a) values('a1');
> insert into A(a, b) values('a2', 'b2');
>
> select count(*) from A where b = null;      /* Returns 1, ok */

no

> select count(*) from A where b != null;     /* Returns 0 ... not ok! */

yes

> What am i missing?  Shouldn't those two sets be complimentary?

They should.  There's a thread about the abnormal behaviour of foo = NULL
in the -hackers archive of last/this(?) week.  You should use 'foo is
[not] null' anyway.

See also

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

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter



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

Предыдущее
От: John Scott
Дата:
Сообщение: not null - trivial, unexpected behavior
Следующее
От: Tom Lane
Дата:
Сообщение: Re: not null - trivial, unexpected behavior