mirror of
https://github.com/postgres/postgres.git
synced 2025-07-05 07:21:24 +03:00
Revise child-to-root tuple conversion map management.
Store the tuple conversion map to convert a tuple from a child table's format to the root format in a new ri_ChildToRootMap field in ResultRelInfo. It is initialized if transition tuple capture for FOR STATEMENT triggers or INSERT tuple routing on a partitioned table is needed. Previously, ModifyTable kept the maps in the per-subplan ModifyTableState->mt_per_subplan_tupconv_maps array, or when tuple routing was used, in ResultRelInfo->ri_Partitioninfo->pi_PartitionToRootMap. The new field replaces both of those. Now that the child-to-root tuple conversion map is always available in ResultRelInfo (when needed), remove the TransitionCaptureState.tcs_map field. The callers of Exec*Trigger() functions no longer need to set or save it, which is much less confusing and bug-prone. Also, as a future optimization, this will allow us to delay creating the map for a given result relation until the relation is actually processed during execution. Author: Amit Langote Discussion: https://www.postgresql.org/message-id/CA%2BHiwqHtCWLdK-LO%3DNEsvOdHx%2B7yv4mE_zYK0i3BH7dXb-wxog%40mail.gmail.com
This commit is contained in:
@ -486,6 +486,13 @@ typedef struct ResultRelInfo
|
||||
/* info for partition tuple routing (NULL if not set up yet) */
|
||||
struct PartitionRoutingInfo *ri_PartitionInfo;
|
||||
|
||||
/*
|
||||
* Map to convert child result relation tuples to the format of the table
|
||||
* actually mentioned in the query (called "root"). Set only if
|
||||
* transition tuple capture or update partition row movement is active.
|
||||
*/
|
||||
TupleConversionMap *ri_ChildToRootMap;
|
||||
|
||||
/* for use by copy.c when performing multi-inserts */
|
||||
struct CopyMultiInsertBuffer *ri_CopyMultiInsertBuffer;
|
||||
} ResultRelInfo;
|
||||
@ -1179,9 +1186,6 @@ typedef struct ModifyTableState
|
||||
|
||||
/* controls transition table population for INSERT...ON CONFLICT UPDATE */
|
||||
struct TransitionCaptureState *mt_oc_transition_capture;
|
||||
|
||||
/* Per plan map for tuple conversion from child to root */
|
||||
TupleConversionMap **mt_per_subplan_tupconv_maps;
|
||||
} ModifyTableState;
|
||||
|
||||
/* ----------------
|
||||
|
Reference in New Issue
Block a user