diff options
Diffstat (limited to 'src/backend/optimizer/plan/initsplan.c')
-rw-r--r-- | src/backend/optimizer/plan/initsplan.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/backend/optimizer/plan/initsplan.c b/src/backend/optimizer/plan/initsplan.c index a19260f9bc4..c301e6dffc4 100644 --- a/src/backend/optimizer/plan/initsplan.c +++ b/src/backend/optimizer/plan/initsplan.c @@ -1189,23 +1189,8 @@ deconstruct_distribute(PlannerInfo *root, JoinTreeItem *jtitem) if (j->jointype == JOIN_SEMI) ojscope = NULL; else - { ojscope = bms_union(sjinfo->min_lefthand, sjinfo->min_righthand); - - /* - * Add back any commutable lower OJ relids that were removed - * from min_lefthand or min_righthand, else the ojscope - * cross-check in distribute_qual_to_rels will complain. If - * any such OJs were removed, we will postpone processing of - * non-degenerate clauses, so this addition doesn't affect - * anything except that cross-check and some Asserts. Real - * clause positioning decisions will be made later, when we - * revisit the postponed clauses. - */ - if (sjinfo->commute_below) - ojscope = bms_add_members(ojscope, sjinfo->commute_below); - } } else { @@ -1221,7 +1206,21 @@ deconstruct_distribute(PlannerInfo *root, JoinTreeItem *jtitem) * they will drop down below this join anyway.) */ if (j->jointype == JOIN_LEFT && sjinfo->lhs_strict) + { postponed_oj_qual_list = &jtitem->oj_joinclauses; + + /* + * Add back any commutable lower OJ relids that were removed from + * min_lefthand or min_righthand, else the ojscope cross-check in + * distribute_qual_to_rels will complain. Since we are postponing + * processing of non-degenerate clauses, this addition doesn't + * affect anything except that cross-check. Real clause + * positioning decisions will be made later, when we revisit the + * postponed clauses. + */ + if (sjinfo->commute_below) + ojscope = bms_add_members(ojscope, sjinfo->commute_below); + } else postponed_oj_qual_list = NULL; |