mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Rearrange CustomScan API.
Make it work more like FDW plans do: instead of assuming that there are expressions in a CustomScan plan node that the core code doesn't know about, insist that all subexpressions that need planner attention be in a "custom_exprs" list in the Plan representation. (Of course, the custom plugin can break the list apart again at executor initialization.) This lets us revert the parts of the patch that exposed setrefs.c and subselect.c processing to the outside world. Also revert the GetSpecialCustomVar stuff in ruleutils.c; that concept may work in future, but it's far from fully baked right now.
This commit is contained in:
@ -94,6 +94,7 @@ static Plan *set_subqueryscan_references(PlannerInfo *root,
|
||||
SubqueryScan *plan,
|
||||
int rtoffset);
|
||||
static bool trivial_subqueryscan(SubqueryScan *plan);
|
||||
static Node *fix_scan_expr(PlannerInfo *root, Node *node, int rtoffset);
|
||||
static Node *fix_scan_expr_mutator(Node *node, fix_scan_expr_context *context);
|
||||
static bool fix_scan_expr_walker(Node *node, fix_scan_expr_context *context);
|
||||
static void set_join_references(PlannerInfo *root, Join *join, int rtoffset);
|
||||
@ -580,23 +581,15 @@ set_plan_refs(PlannerInfo *root, Plan *plan, int rtoffset)
|
||||
|
||||
case T_CustomScan:
|
||||
{
|
||||
CustomScan *cscan = (CustomScan *) plan;
|
||||
CustomScan *splan = (CustomScan *) plan;
|
||||
|
||||
cscan->scan.scanrelid += rtoffset;
|
||||
cscan->scan.plan.targetlist =
|
||||
fix_scan_list(root, cscan->scan.plan.targetlist, rtoffset);
|
||||
cscan->scan.plan.qual =
|
||||
fix_scan_list(root, cscan->scan.plan.qual, rtoffset);
|
||||
|
||||
/*
|
||||
* The core implementation applies the routine to fixup varno
|
||||
* on the target-list and scan qualifier. If custom-scan has
|
||||
* additional expression nodes on its private fields, it has
|
||||
* to apply same fixup on them. Otherwise, the custom-plan
|
||||
* provider can skip this callback.
|
||||
*/
|
||||
if (cscan->methods->SetCustomScanRef)
|
||||
cscan->methods->SetCustomScanRef(root, cscan, rtoffset);
|
||||
splan->scan.scanrelid += rtoffset;
|
||||
splan->scan.plan.targetlist =
|
||||
fix_scan_list(root, splan->scan.plan.targetlist, rtoffset);
|
||||
splan->scan.plan.qual =
|
||||
fix_scan_list(root, splan->scan.plan.qual, rtoffset);
|
||||
splan->custom_exprs =
|
||||
fix_scan_list(root, splan->custom_exprs, rtoffset);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1182,7 +1175,7 @@ fix_param_node(PlannerInfo *root, Param *p)
|
||||
* looking up operator opcode info for OpExpr and related nodes,
|
||||
* and adding OIDs from regclass Const nodes into root->glob->relationOids.
|
||||
*/
|
||||
Node *
|
||||
static Node *
|
||||
fix_scan_expr(PlannerInfo *root, Node *node, int rtoffset)
|
||||
{
|
||||
fix_scan_expr_context context;
|
||||
|
Reference in New Issue
Block a user