Re: in(NULL)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: in(NULL)
Дата
Msg-id 5312.1022163689@sss.pgh.pa.us
обсуждение исходный текст
Ответ на in(NULL)  (jose <jose@sferacarta.com>)
Список pgsql-bugs
jose <jose@sferacarta.com> writes:
> I think I found a bug using the IN operator.
> select * from t where b not in (11,22,NULL);

This is not a bug.  The behavior of NOT IN with NULLs is not very
intuitive but it is correct according to the SQL standard.  The result
can only be FALSE (when b is 11 or 22, IN is definitely TRUE, so NOT IN
is definitely FALSE) or NULL (for anything else, the result is UNKNOWN).
Either way, this query will select no rows.

> I tried the same quesry in mysql and it give me
> a different result. Who are right?

If mysql gets this wrong, then they are not implementing NULLs per SQL
spec.

            regards, tom lane

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

Предыдущее
От: "Joel Burton"
Дата:
Сообщение: Re: in(NULL)
Следующее
От: pgsql-bugs@postgresql.org
Дата:
Сообщение: Bug #674: JDBC: DatabaseMetaData.getColumns() "feature"