aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeModifyTable.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/executor/nodeModifyTable.c')
-rw-r--r--src/backend/executor/nodeModifyTable.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c
index 7de4568b03e..e86ed44a476 100644
--- a/src/backend/executor/nodeModifyTable.c
+++ b/src/backend/executor/nodeModifyTable.c
@@ -1933,16 +1933,9 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
estate->es_result_relation_info = saved_resultRelInfo;
- /* The root table RT index is at the head of the partitioned_rels list */
- if (node->partitioned_rels)
- {
- Index root_rti;
- Oid root_oid;
-
- root_rti = linitial_int(node->partitioned_rels);
- root_oid = getrelid(root_rti, estate->es_range_table);
- rel = heap_open(root_oid, NoLock); /* locked by InitPlan */
- }
+ /* Examine the root partition if we have one, else target table */
+ if (mtstate->rootResultRelInfo)
+ rel = mtstate->rootResultRelInfo->ri_RelationDesc;
else
rel = mtstate->resultRelInfo->ri_RelationDesc;
@@ -2134,10 +2127,6 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
mtstate->ps.ps_ExprContext = NULL;
}
- /* Close the root partitioned rel if we opened it above. */
- if (rel != mtstate->resultRelInfo->ri_RelationDesc)
- heap_close(rel, NoLock);
-
/*
* If needed, Initialize target list, projection and qual for ON CONFLICT
* DO UPDATE.