• R/O
  • HTTP
  • SSH
  • HTTPS

pg_hint_plan: コミット

firtst release


コミットメタ情報

リビジョンcce8d9062b2c72cd122710901a39667b1b3e7ffc (tree)
日時2017-10-10 10:33:00
作者Kyotaro Horiguchi <horiguchi.kyotaro@lab....>
コミッターKyotaro Horiguchi

ログメッセージ

Reflected changes as of release 10.0.

add_paths_to_append_rel gets modified as of relase 10.0. Reflected it
to core.c

変更サマリ

差分

--- a/core.c
+++ b/core.c
@@ -168,13 +168,34 @@ add_paths_to_append_rel(PlannerInfo *root, RelOptInfo *rel,
168168 ListCell *l;
169169 List *partitioned_rels = NIL;
170170 RangeTblEntry *rte;
171+ bool build_partitioned_rels = false;
171172
173+ /*
174+ * A plain relation will already have a PartitionedChildRelInfo if it is
175+ * partitioned. For a subquery RTE, no PartitionedChildRelInfo exists; we
176+ * collect all partitioned_rels associated with any child. (This assumes
177+ * that we don't need to look through multiple levels of subquery RTEs; if
178+ * we ever do, we could create a PartitionedChildRelInfo with the
179+ * accumulated list of partitioned_rels which would then be found when
180+ * populated our parent rel with paths. For the present, that appears to
181+ * be unnecessary.)
182+ */
172183 rte = planner_rt_fetch(rel->relid, root);
173- if (rte->relkind == RELKIND_PARTITIONED_TABLE)
184+ switch (rte->rtekind)
174185 {
175- partitioned_rels = get_partitioned_child_rels(root, rel->relid);
176- /* The root partitioned table is included as a child rel */
177- Assert(list_length(partitioned_rels) >= 1);
186+ case RTE_RELATION:
187+ if (rte->relkind == RELKIND_PARTITIONED_TABLE)
188+ {
189+ partitioned_rels =
190+ get_partitioned_child_rels(root, rel->relid);
191+ Assert(list_length(partitioned_rels) >= 1);
192+ }
193+ break;
194+ case RTE_SUBQUERY:
195+ build_partitioned_rels = true;
196+ break;
197+ default:
198+ elog(ERROR, "unexpcted rtekind: %d", (int) rte->rtekind);
178199 }
179200
180201 /*
@@ -188,6 +209,19 @@ add_paths_to_append_rel(PlannerInfo *root, RelOptInfo *rel,
188209 ListCell *lcp;
189210
190211 /*
212+ * If we need to build partitioned_rels, accumulate the partitioned
213+ * rels for this child.
214+ */
215+ if (build_partitioned_rels)
216+ {
217+ List *cprels;
218+
219+ cprels = get_partitioned_child_rels(root, childrel->relid);
220+ partitioned_rels = list_concat(partitioned_rels,
221+ list_copy(cprels));
222+ }
223+
224+ /*
191225 * If child has an unparameterized cheapest-total path, add that to
192226 * the unparameterized Append path we are constructing for the parent.
193227 * If not, there's no workable unparameterized path.
@@ -1455,4 +1489,3 @@ restriction_is_constant_false(List *restrictlist, bool only_pushed_down)
14551489 }
14561490 return false;
14571491 }
1458-
旧リポジトリブラウザで表示