mirror of
https://github.com/postgres/postgres.git
synced 2025-10-29 22:49:41 +03:00
Allow insert and update tuple routing and COPY for foreign tables.
Also enable this for postgres_fdw. Etsuro Fujita, based on an earlier patch by Amit Langote. The larger patch series of which this is a part has been reviewed by Amit Langote, David Fetter, Maksim Milyutin, Álvaro Herrera, Stephen Frost, and me. Minor documentation changes to the final version by me. Discussion: http://postgr.es/m/29906a26-da12-8c86-4fb9-d8f88442f2b9@lab.ntt.co.jp
This commit is contained in:
@@ -119,6 +119,11 @@ extern ResultRelInfo *ExecInitPartitionInfo(ModifyTableState *mtstate,
|
||||
ResultRelInfo *resultRelInfo,
|
||||
PartitionTupleRouting *proute,
|
||||
EState *estate, int partidx);
|
||||
extern void ExecInitRoutingInfo(ModifyTableState *mtstate,
|
||||
EState *estate,
|
||||
PartitionTupleRouting *proute,
|
||||
ResultRelInfo *partRelInfo,
|
||||
int partidx);
|
||||
extern void ExecSetupChildParentMapForLeaf(PartitionTupleRouting *proute);
|
||||
extern TupleConversionMap *TupConvMapForLeaf(PartitionTupleRouting *proute,
|
||||
ResultRelInfo *rootRelInfo, int leaf_index);
|
||||
@@ -126,6 +131,7 @@ extern HeapTuple ConvertPartitionTupleSlot(TupleConversionMap *map,
|
||||
HeapTuple tuple,
|
||||
TupleTableSlot *new_slot,
|
||||
TupleTableSlot **p_my_slot);
|
||||
extern void ExecCleanupTupleRouting(PartitionTupleRouting *proute);
|
||||
extern void ExecCleanupTupleRouting(ModifyTableState *mtstate,
|
||||
PartitionTupleRouting *proute);
|
||||
|
||||
#endif /* EXECPARTITION_H */
|
||||
|
||||
@@ -98,6 +98,12 @@ typedef TupleTableSlot *(*ExecForeignDelete_function) (EState *estate,
|
||||
typedef void (*EndForeignModify_function) (EState *estate,
|
||||
ResultRelInfo *rinfo);
|
||||
|
||||
typedef void (*BeginForeignInsert_function) (ModifyTableState *mtstate,
|
||||
ResultRelInfo *rinfo);
|
||||
|
||||
typedef void (*EndForeignInsert_function) (EState *estate,
|
||||
ResultRelInfo *rinfo);
|
||||
|
||||
typedef int (*IsForeignRelUpdatable_function) (Relation rel);
|
||||
|
||||
typedef bool (*PlanDirectModify_function) (PlannerInfo *root,
|
||||
@@ -205,6 +211,8 @@ typedef struct FdwRoutine
|
||||
ExecForeignUpdate_function ExecForeignUpdate;
|
||||
ExecForeignDelete_function ExecForeignDelete;
|
||||
EndForeignModify_function EndForeignModify;
|
||||
BeginForeignInsert_function BeginForeignInsert;
|
||||
EndForeignInsert_function EndForeignInsert;
|
||||
IsForeignRelUpdatable_function IsForeignRelUpdatable;
|
||||
PlanDirectModify_function PlanDirectModify;
|
||||
BeginDirectModify_function BeginDirectModify;
|
||||
|
||||
@@ -444,6 +444,9 @@ typedef struct ResultRelInfo
|
||||
/* for removing junk attributes from tuples */
|
||||
JunkFilter *ri_junkFilter;
|
||||
|
||||
/* list of RETURNING expressions */
|
||||
List *ri_returningList;
|
||||
|
||||
/* for computing a RETURNING list */
|
||||
ProjectionInfo *ri_projectReturning;
|
||||
|
||||
@@ -462,6 +465,9 @@ typedef struct ResultRelInfo
|
||||
/* relation descriptor for root partitioned table */
|
||||
Relation ri_PartitionRoot;
|
||||
|
||||
/* true if ready for tuple routing */
|
||||
bool ri_PartitionReadyForRouting;
|
||||
|
||||
int ri_PartitionLeafIndex;
|
||||
/* for running MERGE on this result relation */
|
||||
MergeState *ri_mergeState;
|
||||
|
||||
Reference in New Issue
Block a user