diff options
author | Robert Haas <rhaas@postgresql.org> | 2017-01-19 13:20:11 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2017-01-19 13:20:11 -0500 |
commit | 05bd889904e03479a7169b1c36e0e1db13fff7cb (patch) | |
tree | 90af08c581519107dbdebe0e3815655c282e3799 /src/backend/executor/execMain.c | |
parent | 39162b2030fb0a35a6bb28dc636b5a71b8df8d1c (diff) | |
download | postgresql-05bd889904e03479a7169b1c36e0e1db13fff7cb.tar.gz postgresql-05bd889904e03479a7169b1c36e0e1db13fff7cb.zip |
Fix RETURNING to work correctly with partition tuple routing.
In ExecInsert(), do not switch back to the root partitioned table
ResultRelInfo until after we finish ExecProcessReturning(), so that
RETURNING projection is done using the partition's descriptor. For
the projection to work correctly, we must initialize the same for each
leaf partition during ModifyTableState initialization.
Amit Langote
Diffstat (limited to 'src/backend/executor/execMain.c')
-rw-r--r-- | src/backend/executor/execMain.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index 5457f8fbde5..e6edcc06c23 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -1279,10 +1279,10 @@ InitResultRelInfo(ResultRelInfo *resultRelInfo, /* * This is not our own partition constraint, but rather an ancestor's. * So any Vars in it bear the ancestor's attribute numbers. We must - * switch them to our own. + * switch them to our own. (dummy varno = 1) */ if (partition_check != NIL) - partition_check = map_partition_varattnos(partition_check, + partition_check = map_partition_varattnos(partition_check, 1, resultRelationDesc, partition_root); } |