aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeModifyTable.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2018-01-17 14:44:15 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2018-01-17 14:44:15 -0500
commitdca48d145e0e757f0549430ec48687d12c6b6751 (patch)
tree49b80c744d5baf1cdcff1d4c96dfa94297a1aa77 /src/backend/executor/nodeModifyTable.c
parent9c7d06d60680c7f00d931233873dee81fdb311c6 (diff)
downloadpostgresql-dca48d145e0e757f0549430ec48687d12c6b6751.tar.gz
postgresql-dca48d145e0e757f0549430ec48687d12c6b6751.zip
Remove useless lookup of root partitioned rel in ExecInitModifyTable().
node->partitioned_rels is only set in UPDATE/DELETE cases, but ExecInitModifyTable only uses its "rel" variable in INSERT cases, so the extra logic to find the root rel is just a waste of complexity and cycles. Etsuro Fujita, reviewed by Amit Langote Discussion: https://postgr.es/m/93cf9816-2f7d-0f67-8ed2-4a4e497a6ab8@lab.ntt.co.jp
Diffstat (limited to 'src/backend/executor/nodeModifyTable.c')
-rw-r--r--src/backend/executor/nodeModifyTable.c19
1 files changed, 1 insertions, 18 deletions
diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c
index 55dff5b21a6..c5eca1bb74c 100644
--- a/src/backend/executor/nodeModifyTable.c
+++ b/src/backend/executor/nodeModifyTable.c
@@ -46,7 +46,6 @@
#include "foreign/fdwapi.h"
#include "miscadmin.h"
#include "nodes/nodeFuncs.h"
-#include "parser/parsetree.h"
#include "storage/bufmgr.h"
#include "storage/lmgr.h"
#include "utils/builtins.h"
@@ -1932,20 +1931,8 @@ 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 */
- }
- else
- rel = mtstate->resultRelInfo->ri_RelationDesc;
-
/* Build state for INSERT tuple routing */
+ rel = mtstate->resultRelInfo->ri_RelationDesc;
if (operation == CMD_INSERT &&
rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
{
@@ -2118,10 +2105,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.