Re: possible bug in 8.4 - Mailing list pgsql-hackers

From Tom Lane
Subject Re: possible bug in 8.4
Date
Msg-id 18343.1229627618@sss.pgh.pa.us
Whole thread Raw
In response to Re: possible bug in 8.4  (Gregory Stark <stark@enterprisedb.com>)
Responses Re: possible bug in 8.4
List pgsql-hackers
Gregory Stark <stark@enterprisedb.com> writes:
> I think Postgres can't do better because there could be a NULL in the
> subquery. If there's a NULL in the subquery then no record would match.

Yeah.  NOT IN does not have the right semantics to become an antijoin.

FWIW, you can use a NOT EXISTS:

select a.a from a where not exists (select 1 from b where a.a = b.a);

In HEAD this should give the identical plan to the leftjoin/is null
hack.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Reducing some DDL Locks to ShareLock
Next
From: Gregory Stark
Date:
Subject: Re: possible bug in 8.4