[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-general
Subject:    Re: [GENERAL] NOT IN (NULL) ?
From:       Tom Lane <tgl () sss ! pgh ! pa ! us>
Date:       2010-10-31 17:19:14
Message-ID: 24334.1288545554 () sss ! pgh ! pa ! us
[Download RAW message or body]

"Paul" <magamos@mail.ru> 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

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic