diff options
author | Tom Lane | 2009-05-07 20:13:09 +0000 |
---|---|---|
committer | Tom Lane | 2009-05-07 20:13:09 +0000 |
commit | 2cd57b33cb8c8ddab2cebf4ccbd3894add13896f (patch) | |
tree | b9b811c0aee369466a1dfc6c5d0e06dec4e80a30 | |
parent | 88259b3483bd6d8fee14ef5429b0ce07aa549b25 (diff) |
Ooops ... make_outerjoininfo wasn't actually enforcing the join order
restrictions specified for semijoins in optimizer/README, to wit that
you can't reassociate outer joins into or out of the RHS of a semijoin.
Per report from Heikki.
-rw-r--r-- | src/backend/optimizer/plan/initsplan.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/backend/optimizer/plan/initsplan.c b/src/backend/optimizer/plan/initsplan.c index c211ff00a7..834b6af0dd 100644 --- a/src/backend/optimizer/plan/initsplan.c +++ b/src/backend/optimizer/plan/initsplan.c @@ -654,7 +654,8 @@ make_outerjoininfo(PlannerInfo *root, * lower join's RHS and the lower OJ's join condition is strict, we * can interchange the ordering of the two OJs; otherwise we must add * lower OJ's full syntactic relset to min_righthand. Here, we must - * preserve ordering anyway if the lower OJ is an antijoin. + * preserve ordering anyway if either the current join is a semijoin, + * or the lower OJ is an antijoin. * * Here, we have to consider that "our join condition" includes any * clauses that syntactically appeared above the lower OJ and below @@ -670,6 +671,7 @@ make_outerjoininfo(PlannerInfo *root, if (bms_overlap(right_rels, otherinfo->syn_righthand)) { if (bms_overlap(clause_relids, otherinfo->syn_righthand) || + jointype == JOIN_SEMI || otherinfo->jointype == JOIN_ANTI || !otherinfo->lhs_strict || otherinfo->delay_upper_joins) { |