Re: NULL in IN clause - Mailing list pgsql-sql

From Tom Lane
Subject Re: NULL in IN clause
Date
Msg-id 26534.1129756290@sss.pgh.pa.us
Whole thread Raw
In response to NULL in IN clause  (Havasvölgyi Ottó <h.otto@freemail.hu>)
List pgsql-sql
Havasvölgyi Ottó <h.otto@freemail.hu> writes:
> I have just run this command on 8.0.4 :

> SELECT 'foo' WHERE 0 NOT IN (NULL, 1);

> And it resulted is zero rows.
> Without NULL it is OK.
> Is this a bug, or the standard has such a rule?

This is per spec.

The computation is effectivelyNOT (0 = NULL OR 0 = 1)NOT (NULL OR FALSE)NOT NULLNULL
ie, the result is UNKNOWN, which WHERE treats the same as FALSE.
        regards, tom lane


pgsql-sql by date:

Previous
From: David Dick
Date:
Subject: Re: NULL in IN clause
Next
From: Stephan Szabo
Date:
Subject: Re: NULL in IN clause