aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/plan/createplan.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2015-06-26 09:40:47 -0400
committerRobert Haas <rhaas@postgresql.org>2015-06-26 09:40:47 -0400
commit5ca611841bcd37c7ee8448c46c8398ef8d8edcc4 (patch)
tree492d1f96b9f0b3a25e321f6d58cba98b0a95bfd2 /src/backend/optimizer/plan/createplan.c
parent4b8e24b9ad308c30dbe2184e06848e638e018114 (diff)
downloadpostgresql-5ca611841bcd37c7ee8448c46c8398ef8d8edcc4.tar.gz
postgresql-5ca611841bcd37c7ee8448c46c8398ef8d8edcc4.zip
Improve handling of CustomPath/CustomPlan(State) children.
Allow CustomPath to have a list of paths, CustomPlan a list of plans, and CustomPlanState a list of planstates known to the core system, so that custom path/plan providers can more reasonably use this infrastructure for nodes with multiple children. KaiGai Kohei, per a design suggestion from Tom Lane, with some further kibitzing by me.
Diffstat (limited to 'src/backend/optimizer/plan/createplan.c')
-rw-r--r--src/backend/optimizer/plan/createplan.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c
index a3482def643..dc2dcbf93f7 100644
--- a/src/backend/optimizer/plan/createplan.c
+++ b/src/backend/optimizer/plan/createplan.c
@@ -2157,6 +2157,16 @@ create_customscan_plan(PlannerInfo *root, CustomPath *best_path,
{
CustomScan *cplan;
RelOptInfo *rel = best_path->path.parent;
+ List *custom_plans = NIL;
+ ListCell *lc;
+
+ /* Recursively transform child paths. */
+ foreach (lc, best_path->custom_paths)
+ {
+ Plan *plan = create_plan_recurse(root, (Path *) lfirst(lc));
+
+ custom_plans = lappend(custom_plans, plan);
+ }
/*
* Sort clauses into the best execution order, although custom-scan
@@ -2172,7 +2182,8 @@ create_customscan_plan(PlannerInfo *root, CustomPath *best_path,
rel,
best_path,
tlist,
- scan_clauses);
+ scan_clauses,
+ custom_plans);
Assert(IsA(cplan, CustomScan));
/*