Re: IN joining

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dennis Haney <davh(at)diku(dot)dk>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: IN joining
Date: 2004-03-05 21:04:59
Message-ID: 11205.1078520699@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dennis Haney <davh(at)diku(dot)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_IN handles
* RHS/LHS.
*
* JOIN_UNIQUE_OUTER will work if outerrel is exactly RHS;
* 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

In response to

  • IN joining at 2004-03-05 17:28:54 from Dennis Haney

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Sullivan 2004-03-05 21:08:26 Re: 7.4.2 release notes
Previous Message Bruce Momjian 2004-03-05 20:00:18 7.4.2 release notes