Skip to content

Commit 480f1f4

Browse files
committed
Teach adjust_appendrel_attrs(_multilevel) to do multiple translations.
Currently, child relations are always base relations, so when we translate parent relids to child relids, we only need to translate a singler relid. However, the proposed partition-wise join feature will create child joins, which will mean we need to translate a set of parent relids to the corresponding child relids. This is preliminary refactoring to make that possible. Ashutosh Bapat. Review and testing of the larger patch set of which this is a part by Amit Langote, Rajkumar Raghuwanshi, Rafia Sabih, Thomas Munro, Dilip Kumar, and me. Some adjustments, mostly cosmetic, by me. Discussion: http://postgr.es/m/CA+TgmobQK80vtXjAsPZWWXd7c8u13G86gmuLupN+uUJjA+i4nA@mail.gmail.com
1 parent d57929a commit 480f1f4

File tree

5 files changed

+200
-72
lines changed

5 files changed

+200
-72
lines changed

src/backend/optimizer/path/allpaths.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ set_append_rel_size(PlannerInfo *root, RelOptInfo *rel,
942942
Assert(IsA(rinfo, RestrictInfo));
943943
childqual = adjust_appendrel_attrs(root,
944944
(Node *) rinfo->clause,
945-
appinfo);
945+
1, &appinfo);
946946
childqual = eval_const_expressions(root, childqual);
947947
/* check for flat-out constant */
948948
if (childqual && IsA(childqual, Const))
@@ -1061,11 +1061,11 @@ set_append_rel_size(PlannerInfo *root, RelOptInfo *rel,
10611061
childrel->joininfo = (List *)
10621062
adjust_appendrel_attrs(root,
10631063
(Node *) rel->joininfo,
1064-
appinfo);
1064+
1, &appinfo);
10651065
childrel->reltarget->exprs = (List *)
10661066
adjust_appendrel_attrs(root,
10671067
(Node *) rel->reltarget->exprs,
1068-
appinfo);
1068+
1, &appinfo);
10691069

10701070
/*
10711071
* We have to make child entries in the EquivalenceClass data

src/backend/optimizer/path/equivclass.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,8 @@ generate_join_implied_equalities_broken(PlannerInfo *root,
13291329
if (IS_OTHER_REL(inner_rel) && result != NIL)
13301330
result = (List *) adjust_appendrel_attrs_multilevel(root,
13311331
(Node *) result,
1332-
inner_rel);
1332+
inner_rel->relids,
1333+
inner_rel->top_parent_relids);
13331334

13341335
return result;
13351336
}
@@ -2112,7 +2113,7 @@ add_child_rel_equivalences(PlannerInfo *root,
21122113
child_expr = (Expr *)
21132114
adjust_appendrel_attrs(root,
21142115
(Node *) cur_em->em_expr,
2115-
appinfo);
2116+
1, &appinfo);
21162117

21172118
/*
21182119
* Transform em_relids to match. Note we do *not* do

src/backend/optimizer/plan/planner.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1142,7 +1142,7 @@ inheritance_planner(PlannerInfo *root)
11421142
subroot->parse = (Query *)
11431143
adjust_appendrel_attrs(root,
11441144
(Node *) parse,
1145-
appinfo);
1145+
1, &appinfo);
11461146

11471147
/*
11481148
* If there are securityQuals attached to the parent, move them to the

0 commit comments

Comments
 (0)