Re: NOT IN (NULL) ?

Поиск
Список
Период
Сортировка
Искать
От
Tom Lane
Тема
Re: NOT IN (NULL) ?
Дата
Msg-id
24334.1288545554@sss.pgh.pa.us
Ответ на
Список
Дерево обсуждения
NOT IN (NULL) ? "Paul" <magamos@mail.ru>
Re: NOT IN (NULL) ? Tom Lane <tgl@sss.pgh.pa.us>
Re: NOT IN (NULL) ? "Paul" <magamos@mail.ru>
Re: NOT IN (NULL) ? Tom Lane <tgl@sss.pgh.pa.us>
Re: NOT IN (NULL) ? Pavel Stehule <pavel.stehule@gmail.com>
Re: NOT IN (NULL) ? Raymond O'Donnell <rod@iol.ie>
"Paul"  writes:
> But  there  is  not  such  thing  in PostgreSQL as empty set as "IN ()" that must be
> false, because nothing element may be found in empty set.
> And  I  thought that instead of "IN ()" I could use "IN (NULL)", but I
> was failed and result was NULL and not FALSE. :(

NULL is not an alternative spelling for an empty set.

You could get an empty IN set by using a sub-select yielding no rows,
for example

regression=# select 1 in (select 1 where false);
 ?column? 
----------
 f
(1 row)

regression=# select 1 not in (select 1 where false);
 ?column? 
----------
 t
(1 row)

			regards, tom lane
В списке pgsql-general по дате отправления
От: Pavel Stehule
Дата:
Сообщение: Re: NOT IN (NULL) ?
От: Alexander Farber
Дата:
FAQ