aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/execMain.c
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2022-12-02 10:35:55 +0100
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2022-12-02 10:35:55 +0100
commitfb958b5da86da69651f6fb9f540c2cfb1346cdc5 (patch)
treea059d6e4ceab797bc94f2212a5d748f5e1b3fa6d /src/backend/executor/execMain.c
parent40b1491357a4a092ea054176944cf76e2fe3eff8 (diff)
downloadpostgresql-fb958b5da86da69651f6fb9f540c2cfb1346cdc5.tar.gz
postgresql-fb958b5da86da69651f6fb9f540c2cfb1346cdc5.zip
Generalize ri_RootToPartitionMap to use for non-partition children
ri_RootToPartitionMap is currently only initialized for tuple routing target partitions, though a future commit will need the ability to use it even for the non-partition child tables, so make adjustments to the decouple it from the partitioning code. Also, make it lazily initialized via ExecGetRootToChildMap(), making that function its preferred access path. Existing third-party code accessing it directly should no longer do so; consequently, it's been renamed to ri_RootToChildMap, which also makes it consistent with ri_ChildToRootMap. ExecGetRootToChildMap() houses the logic of setting the map appropriately depending on whether a given child relation is partition or not. To support this, also add a separate entry point for TupleConversionMap creation that receives an AttrMap. No new code here, just split an existing function in two. Author: Amit Langote <amitlangote09@gmail.com> Discussion: https://postgr.es/m/CA+HiwqEYUhDXSK5BTvG_xk=eaAEJCD4GS3C6uH7ybBvv+Z_Tmg@mail.gmail.com
Diffstat (limited to 'src/backend/executor/execMain.c')
-rw-r--r--src/backend/executor/execMain.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index b6751da5743..12ff4f3de58 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -1256,9 +1256,11 @@ InitResultRelInfo(ResultRelInfo *resultRelInfo,
* this field is filled in ExecInitModifyTable().
*/
resultRelInfo->ri_RootResultRelInfo = partition_root_rri;
- resultRelInfo->ri_RootToPartitionMap = NULL; /* set by
- * ExecInitRoutingInfo */
- resultRelInfo->ri_PartitionTupleSlot = NULL; /* ditto */
+ /* Set by ExecGetRootToChildMap */
+ resultRelInfo->ri_RootToChildMap = NULL;
+ resultRelInfo->ri_RootToChildMapValid = false;
+ /* Set by ExecInitRoutingInfo */
+ resultRelInfo->ri_PartitionTupleSlot = NULL;
resultRelInfo->ri_ChildToRootMap = NULL;
resultRelInfo->ri_ChildToRootMapValid = false;
resultRelInfo->ri_CopyMultiInsertBuffer = NULL;