Skip site navigation (1) Skip section navigation (2)


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Paul" <magamos(at)mail(dot)ru>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: NOT IN (NULL) ?
Date: 2010-10-31 17:19:14
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
"Paul" <magamos(at)mail(dot)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);
(1 row)

regression=# select 1 not in (select 1 where false);
(1 row)

			regards, tom lane

In response to

pgsql-general by date

Next:From: Alexander FarberDate: 2010-10-31 17:28:56
Subject: Re: Implementing replace function
Previous:From: Pavel StehuleDate: 2010-10-31 17:08:16
Subject: Re: NOT IN (NULL) ?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group