mirror of
https://github.com/postgres/postgres.git
synced 2025-11-09 06:21:09 +03:00
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.
This commit is contained in:
@@ -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));
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user