From: Tom Lane <tgl@sss.pgh.pa.us>
To: Havasvölgyi Ottó <h.otto@freemail.hu>
Cc: pgsql-sql@postgresql.org
Subject: Re: NULL in IN clause
Date: Wed, 19 Oct 2005 17:11:30 -0400
Message-ID: <26534.1129756290@sss.pgh.pa.us> (raw)
In-Reply-To: <001a01c5d4ea$243a1830$6400a8c0@OTTO>
References: <00cc01c5d00b$3a67dc70$1102a8c0@dream>
<1129681803.15546.21.camel@state.g2switchworks.com>
<001a01c5d4ea$243a1830$6400a8c0@OTTO>
=?iso-8859-2?Q?Havasv=F6lgyi_Ott=F3?= <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 effectively
NOT (0 = NULL OR 0 = 1)
NOT (NULL OR FALSE)
NOT NULL
NULL
ie, the result is UNKNOWN, which WHERE treats the same as FALSE.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, h.otto@freemail.hu
Subject: Re: NULL in IN clause
In-Reply-To: <26534.1129756290@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox