diff options
Diffstat (limited to 'src/backend/optimizer/plan/createplan.c')
-rw-r--r-- | src/backend/optimizer/plan/createplan.c | 97 |
1 files changed, 49 insertions, 48 deletions
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c index 0a85cd99061..e6bd4c326ca 100644 --- a/src/backend/optimizer/plan/createplan.c +++ b/src/backend/optimizer/plan/createplan.c @@ -78,8 +78,8 @@ static WorkTableScan *create_worktablescan_plan(PlannerInfo *root, Path *best_pa static ForeignScan *create_foreignscan_plan(PlannerInfo *root, ForeignPath *best_path, List *tlist, List *scan_clauses); static Plan *create_customscan_plan(PlannerInfo *root, - CustomPath *best_path, - List *tlist, List *scan_clauses); + CustomPath *best_path, + List *tlist, List *scan_clauses); static NestLoop *create_nestloop_plan(PlannerInfo *root, NestPath *best_path, Plan *outer_plan, Plan *inner_plan); static MergeJoin *create_mergejoin_plan(PlannerInfo *root, MergePath *best_path, @@ -1083,52 +1083,6 @@ create_unique_plan(PlannerInfo *root, UniquePath *best_path) return plan; } -/* - * create_custom_plan - * - * Transform a CustomPath into a Plan. - */ -static Plan * -create_customscan_plan(PlannerInfo *root, CustomPath *best_path, - List *tlist, List *scan_clauses) -{ - Plan *plan; - RelOptInfo *rel = best_path->path.parent; - - /* - * Right now, all we can support is CustomScan node which is associated - * with a particular base relation to be scanned. - */ - Assert(rel && rel->reloptkind == RELOPT_BASEREL); - - /* - * Sort clauses into the best execution order, although custom-scan - * provider can reorder them again. - */ - scan_clauses = order_qual_clauses(root, scan_clauses); - - /* - * Create a CustomScan (or its inheritance) node according to - * the supplied CustomPath. - */ - plan = best_path->methods->PlanCustomPath(root, rel, best_path, tlist, - scan_clauses); - - /* - * NOTE: unlike create_foreignscan_plan(), it is responsibility of - * the custom plan provider to replace outer-relation variables - * with nestloop params, because we cannot know how many expression - * trees are held in the private fields. - */ - - /* - * Copy cost data from Path to Plan; no need to make custom-plan - * providers do this - */ - copy_path_costsize(plan, &best_path->path); - - return plan; -} /***************************************************************************** * @@ -2063,6 +2017,53 @@ create_foreignscan_plan(PlannerInfo *root, ForeignPath *best_path, return scan_plan; } +/* + * create_custom_plan + * + * Transform a CustomPath into a Plan. + */ +static Plan * +create_customscan_plan(PlannerInfo *root, CustomPath *best_path, + List *tlist, List *scan_clauses) +{ + Plan *plan; + RelOptInfo *rel = best_path->path.parent; + + /* + * Right now, all we can support is CustomScan node which is associated + * with a particular base relation to be scanned. + */ + Assert(rel && rel->reloptkind == RELOPT_BASEREL); + + /* + * Sort clauses into the best execution order, although custom-scan + * provider can reorder them again. + */ + scan_clauses = order_qual_clauses(root, scan_clauses); + + /* + * Invoke custom plan provider to create the Plan node represented by the + * CustomPath. + */ + plan = best_path->methods->PlanCustomPath(root, rel, best_path, tlist, + scan_clauses); + + /* + * NOTE: unlike create_foreignscan_plan(), it is the responsibility of the + * custom plan provider to replace outer-relation variables with nestloop + * params, because we cannot know what expression trees may be held in + * private fields. + */ + + /* + * Copy cost data from Path to Plan; no need to make custom-plan providers + * do this + */ + copy_path_costsize(plan, &best_path->path); + + return plan; +} + /***************************************************************************** * |