aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeModifyTable.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2017-01-04 13:05:29 -0500
committerRobert Haas <rhaas@postgresql.org>2017-01-04 13:16:59 -0500
commit345b2dcf070bd8fbccde643b1b2856027623e9e5 (patch)
tree737eb093564471c2519b1a35790fe4568e931e80 /src/backend/executor/nodeModifyTable.c
parent6667d9a6d77b9a6eac89638ac363b6d03da253c1 (diff)
downloadpostgresql-345b2dcf070bd8fbccde643b1b2856027623e9e5.tar.gz
postgresql-345b2dcf070bd8fbccde643b1b2856027623e9e5.zip
Move partition_tuple_slot out of EState.
Commit 2ac3ef7a01df859c62d0a02333b646d65eaec5ff added a TupleTapleSlot for partition tuple slot to EState (es_partition_tuple_slot) but it's more logical to have it as part of ModifyTableState (mt_partition_tuple_slot) and CopyState (partition_tuple_slot). Discussion: http://postgr.es/m/1bd459d9-4c0c-197a-346e-e5e59e217d97@lab.ntt.co.jp Amit Langote, per a gripe from me
Diffstat (limited to 'src/backend/executor/nodeModifyTable.c')
-rw-r--r--src/backend/executor/nodeModifyTable.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c
index c7dd148944e..aa364707f8d 100644
--- a/src/backend/executor/nodeModifyTable.c
+++ b/src/backend/executor/nodeModifyTable.c
@@ -329,7 +329,7 @@ ExecInsert(ModifyTableState *mtstate,
* Use the dedicated slot for that.
*/
oldslot = slot;
- slot = estate->es_partition_tuple_slot;
+ slot = mtstate->mt_partition_tuple_slot;
Assert(slot != NULL);
ExecSetSlotDescriptor(slot, RelationGetDescr(partrel));
ExecStoreTuple(tuple, slot, InvalidBuffer, true);
@@ -1738,6 +1738,7 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
PartitionDispatch *partition_dispatch_info;
ResultRelInfo *partitions;
TupleConversionMap **partition_tupconv_maps;
+ TupleTableSlot *partition_tuple_slot;
int num_parted,
num_partitions;
@@ -1745,21 +1746,15 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
&partition_dispatch_info,
&partitions,
&partition_tupconv_maps,
+ &partition_tuple_slot,
&num_parted, &num_partitions);
mtstate->mt_partition_dispatch_info = partition_dispatch_info;
mtstate->mt_num_dispatch = num_parted;
mtstate->mt_partitions = partitions;
mtstate->mt_num_partitions = num_partitions;
mtstate->mt_partition_tupconv_maps = partition_tupconv_maps;
-
- /*
- * Initialize a dedicated slot to manipulate tuples of any given
- * partition's rowtype.
- */
- estate->es_partition_tuple_slot = ExecInitExtraTupleSlot(estate);
+ mtstate->mt_partition_tuple_slot = partition_tuple_slot;
}
- else
- estate->es_partition_tuple_slot = NULL;
/*
* Initialize any WITH CHECK OPTION constraints if needed.
@@ -2100,6 +2095,10 @@ ExecEndModifyTable(ModifyTableState *node)
heap_close(resultRelInfo->ri_RelationDesc, NoLock);
}
+ /* Release the standalone partition tuple descriptor, if any */
+ if (node->mt_partition_tuple_slot)
+ ExecDropSingleTupleTableSlot(node->mt_partition_tuple_slot);
+
/*
* Free the exprcontext
*/