Re: IN joining - Mailing list pgsql-hackers

From Tom Lane
Subject Re: IN joining
Date
Msg-id 11205.1078520699@sss.pgh.pa.us
Whole thread Raw
In response to IN joining  (Dennis Haney <davh@diku.dk>)
Responses Re: IN joining
List pgsql-hackers
Dennis Haney <davh@diku.dk> writes:
> Consider this example:
> SELECT * FROM a,b WHERE a.id = b.id AND (a.id) IN (SELECT c.id FROM c)
> the possible execution trees are {{a,b}, {c}}, {{a,c},{b}} and the code 
> seems to also permit {{b,c},{a}}.

No, it does not --- as you say, that would give wrong answers.  That
case is eliminated by the tests following this comment:
            * JOIN_IN technique will work if outerrel includes LHS and            * innerrel is exactly RHS; conversely
JOIN_REVERSE_INhandles            * RHS/LHS.            *            * JOIN_UNIQUE_OUTER will work if outerrel is
exactlyRHS;            * conversely JOIN_UNIQUE_INNER will work if innerrel is            * exactly RHS.
 

Joining {b,c} to {a} does not meet any of those four allowed cases.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: 7.4.2 release notes
Next
From: Andrew Sullivan
Date:
Subject: Re: 7.4.2 release notes