From: | elein <elein(at)varlena(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | elein <elein(at)varlena(dot)com>, George Pavlov <gpavlov(at)mynewplace(dot)com>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: "large" IN/NOT IN subqueries result in query returning wrong data |
Date: | 2005-12-28 00:35:03 |
Message-ID: | 20051228003503.GE20674@varlena.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Tue, Dec 27, 2005 at 07:25:40PM -0500, Tom Lane wrote:
> elein <elein(at)varlena(dot)com> writes:
> > In 8.0 we get:
>
> > elein=# select 1 in (NULL, 1, 2);
> > ?column?
> > ----------
> > t
> > (1 row)
>
> > elein=# select 3 not in (NULL, 1, 2);
> > ?column?
> > ----------
>
> > (1 row)
>
> > For consistency, either both should return NULL or
> > both return true/false.
>
> The above behavior is correct per spec. Feel free to argue its
> consistency with the SQL committee ;-)
Oh, no! Not the committee!
>
> Note that the above are not inverses because you changed the lefthand
> input. You do get consistent results when you just add or omit NOT:
Yes, you are right. I skipped the permutations to get down to the point.
>
> regression=# select 1 not in (NULL, 1, 2);
> ?column?
> ----------
> f
> (1 row)
>
> regression=# select 3 in (NULL, 1, 2);
> ?column?
> ----------
>
> (1 row)
>
> regards, tom lane
Thanks for your clarification.
~elein
elein(at)varlena(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Don Croata | 2005-12-28 14:29:19 | Cursors and recursion |
Previous Message | Tom Lane | 2005-12-28 00:25:40 | Re: "large" IN/NOT IN subqueries result in query returning wrong data |