Re: NULL in IN clause

From: Terry Fielder <terry(at)ashtonwoodshomes(dot)com>
To: Havasvölgyi Ottó <h(dot)otto(at)freemail(dot)hu>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: NULL in IN clause
Date: 2005-10-19 20:41:48
Message-ID: 4356AF8C.80709@ashtonwoodshomes.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Havasvölgyi Ottó wrote:
> Hi,
>
> I have just run this command on 8.0.4 :
>
> SELECT 'foo' WHERE 0 NOT IN (NULL, 1);

0 <> NULL (Indeed nothing equals NULL, other then sometimes NULL itself)

0 <> 1

Therefore, the statement: 0 NOT IN (NULL, 1)
Should always equate to false.

Therefore No rows returned. Ever.

Terry
>
> And it resulted is zero rows.
> Without NULL it is OK.
> Is this a bug, or the standard has such a rule?
>
> Best Regards,
> Otto
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org
>

--
Terry Fielder
terry(at)greatgulfhomes(dot)com
Associate Director Software Development and Deployment
Great Gulf Homes / Ashton Woods Homes
Fax: (416) 441-9085

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message David Dick 2005-10-19 20:43:56 Re: NULL in IN clause
Previous Message Havasvölgyi Ottó 2005-10-19 20:17:34 NULL in IN clause