|
46 | 46 | #include "foreign/fdwapi.h"
|
47 | 47 | #include "miscadmin.h"
|
48 | 48 | #include "nodes/nodeFuncs.h"
|
49 |
| -#include "parser/parsetree.h" |
50 | 49 | #include "storage/bufmgr.h"
|
51 | 50 | #include "storage/lmgr.h"
|
52 | 51 | #include "utils/builtins.h"
|
@@ -1932,20 +1931,8 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
|
1932 | 1931 |
|
1933 | 1932 | estate->es_result_relation_info = saved_resultRelInfo;
|
1934 | 1933 |
|
1935 |
| - /* The root table RT index is at the head of the partitioned_rels list */ |
1936 |
| - if (node->partitioned_rels) |
1937 |
| - { |
1938 |
| - Index root_rti; |
1939 |
| - Oid root_oid; |
1940 |
| - |
1941 |
| - root_rti = linitial_int(node->partitioned_rels); |
1942 |
| - root_oid = getrelid(root_rti, estate->es_range_table); |
1943 |
| - rel = heap_open(root_oid, NoLock); /* locked by InitPlan */ |
1944 |
| - } |
1945 |
| - else |
1946 |
| - rel = mtstate->resultRelInfo->ri_RelationDesc; |
1947 |
| - |
1948 | 1934 | /* Build state for INSERT tuple routing */
|
| 1935 | + rel = mtstate->resultRelInfo->ri_RelationDesc; |
1949 | 1936 | if (operation == CMD_INSERT &&
|
1950 | 1937 | rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
|
1951 | 1938 | {
|
@@ -2118,10 +2105,6 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
|
2118 | 2105 | mtstate->ps.ps_ExprContext = NULL;
|
2119 | 2106 | }
|
2120 | 2107 |
|
2121 |
| - /* Close the root partitioned rel if we opened it above. */ |
2122 |
| - if (rel != mtstate->resultRelInfo->ri_RelationDesc) |
2123 |
| - heap_close(rel, NoLock); |
2124 |
| - |
2125 | 2108 | /*
|
2126 | 2109 | * If needed, Initialize target list, projection and qual for ON CONFLICT
|
2127 | 2110 | * DO UPDATE.
|
|
0 commit comments