Skip to content

Commit cbcfa03

Browse files
committed
Fix compilation of the code with PostgreSQL HEAD
Upstream commit 9df8f90 has changed the internals of the planner in charge of outer join clauses. This updates the copy of these routines to be able to work with the new changes, by running update_copied_funcs.pl.
1 parent fb4c811 commit cbcfa03

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

core.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,9 +1359,8 @@ try_partitionwise_join(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2,
13591359

13601360
/* Build correct join relids for child join */
13611361
child_joinrelids = bms_union(child_rel1->relids, child_rel2->relids);
1362-
if (child_sjinfo->ojrelid != 0)
1363-
child_joinrelids = bms_add_member(child_joinrelids,
1364-
child_sjinfo->ojrelid);
1362+
child_joinrelids = add_outer_joins_to_relids(root, child_joinrelids,
1363+
child_sjinfo, NULL);
13651364

13661365
/* Find the AppendRelInfo structures */
13671366
appinfos = find_appinfos_by_relids(root, child_joinrelids, &nappinfos);

make_join_rel.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
6868
Relids joinrelids;
6969
SpecialJoinInfo *sjinfo;
7070
bool reversed;
71+
List *pushed_down_joins = NIL;
7172
SpecialJoinInfo sjinfo_data;
7273
RelOptInfo *joinrel;
7374
List *restrictlist;
@@ -87,9 +88,12 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
8788
return NULL;
8889
}
8990

90-
/* If we have an outer join, add its RTI to form the canonical relids. */
91-
if (sjinfo && sjinfo->ojrelid != 0)
92-
joinrelids = bms_add_member(joinrelids, sjinfo->ojrelid);
91+
/*
92+
* Add outer join relid(s) to form the canonical relids. Any added outer
93+
* joins besides sjinfo itself are appended to pushed_down_joins.
94+
*/
95+
joinrelids = add_outer_joins_to_relids(root, joinrelids, sjinfo,
96+
&pushed_down_joins);
9397

9498
/* Swap rels if needed to match the join info. */
9599
if (reversed)
@@ -117,7 +121,8 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
117121
sjinfo->ojrelid = 0;
118122
sjinfo->commute_above_l = NULL;
119123
sjinfo->commute_above_r = NULL;
120-
sjinfo->commute_below = NULL;
124+
sjinfo->commute_below_l = NULL;
125+
sjinfo->commute_below_r = NULL;
121126
/* we don't bother trying to make the remaining fields valid */
122127
sjinfo->lhs_strict = false;
123128
sjinfo->semi_can_btree = false;
@@ -130,7 +135,8 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
130135
* Find or build the join RelOptInfo, and compute the restrictlist that
131136
* goes with this particular joining.
132137
*/
133-
joinrel = build_join_rel(root, joinrelids, rel1, rel2, sjinfo,
138+
joinrel = build_join_rel(root, joinrelids, rel1, rel2,
139+
sjinfo, pushed_down_joins,
134140
&restrictlist);
135141

136142
/* !!! START: HERE IS THE PART WHICH IS ADDED FOR PG_HINT_PLAN !!! */

0 commit comments

Comments
 (0)