1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-30 21:42:05 +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:
Robert Haas
2015-06-26 09:40:47 -04:00
parent 4b8e24b9ad
commit 5ca611841b
8 changed files with 77 additions and 7 deletions

View File

@ -1151,6 +1151,8 @@ set_customscan_references(PlannerInfo *root,
CustomScan *cscan,
int rtoffset)
{
ListCell *lc;
/* Adjust scanrelid if it's valid */
if (cscan->scan.scanrelid > 0)
cscan->scan.scanrelid += rtoffset;
@ -1194,6 +1196,12 @@ set_customscan_references(PlannerInfo *root,
fix_scan_list(root, cscan->custom_exprs, rtoffset);
}
/* Adjust child plan-nodes recursively, if needed */
foreach (lc, cscan->custom_plans)
{
lfirst(lc) = set_plan_refs(root, (Plan *) lfirst(lc), rtoffset);
}
/* Adjust custom_relids if needed */
if (rtoffset > 0)
{