| От | 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 по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера