mirror of
https://github.com/postgres/postgres.git
synced 2025-07-08 11:42:09 +03:00
Include result relation info in direct modify ForeignScan nodes.
FDWs that can perform an UPDATE/DELETE remotely using the "direct modify" set of APIs need to access the ResultRelInfo of the target table. That's currently available in EState.es_result_relation_info, but the next commit will remove that field. This commit adds a new resultRelation field in ForeignScan, to store the target relation's RT index, and the corresponding ResultRelInfo in ForeignScanState. The FDW's PlanDirectModify callback is expected to set 'resultRelation' along with 'operation'. The core code doesn't need them for anything, they are for the convenience of FDW's Begin- and IterateDirectModify callbacks. Authors: Amit Langote, Etsuro Fujita Discussion: https://www.postgresql.org/message-id/CA%2BHiwqGEmiib8FLiHMhKB%2BCH5dRgHSLc5N5wnvc4kym%2BZYpQEQ%40mail.gmail.com
This commit is contained in:
@ -215,6 +215,13 @@ ExecInitForeignScan(ForeignScan *node, EState *estate, int eflags)
|
||||
scanstate->fdwroutine = fdwroutine;
|
||||
scanstate->fdw_state = NULL;
|
||||
|
||||
/*
|
||||
* For the FDW's convenience, look up the modification target relation's.
|
||||
* ResultRelInfo.
|
||||
*/
|
||||
if (node->resultRelation > 0)
|
||||
scanstate->resultRelInfo = estate->es_result_relations[node->resultRelation - 1];
|
||||
|
||||
/* Initialize any outer plan. */
|
||||
if (outerPlan(node))
|
||||
outerPlanState(scanstate) =
|
||||
|
Reference in New Issue
Block a user