mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +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:
@@ -603,17 +603,24 @@ _copyForeignScan(const ForeignScan *from)
|
||||
static CustomScan *
|
||||
_copyCustomScan(const CustomScan *from)
|
||||
{
|
||||
CustomScan *newnode;
|
||||
CustomScan *newnode = makeNode(CustomScan);
|
||||
|
||||
newnode = from->methods->CopyCustomScan(from);
|
||||
Assert(nodeTag(newnode) == nodeTag(from));
|
||||
|
||||
CopyScanFields((const Scan *) from, (Scan *) newnode);
|
||||
COPY_SCALAR_FIELD(flags);
|
||||
/*
|
||||
* NOTE: The method field of CustomScan is required to be a pointer
|
||||
* to a static table of callback functions. So, we don't copy the
|
||||
* table itself, just reference the original one.
|
||||
* copy node superclass fields
|
||||
*/
|
||||
CopyScanFields((const Scan *) from, (Scan *) newnode);
|
||||
|
||||
/*
|
||||
* copy remainder of node
|
||||
*/
|
||||
COPY_SCALAR_FIELD(flags);
|
||||
COPY_NODE_FIELD(custom_exprs);
|
||||
COPY_NODE_FIELD(custom_private);
|
||||
|
||||
/*
|
||||
* NOTE: The method field of CustomScan is required to be a pointer to a
|
||||
* static table of callback functions. So we don't copy the table itself,
|
||||
* just reference the original one.
|
||||
*/
|
||||
COPY_SCALAR_FIELD(methods);
|
||||
|
||||
|
Reference in New Issue
Block a user