mirror of
https://github.com/postgres/postgres.git
synced 2025-08-19 23:22:23 +03:00
Fix MERGE with DO NOTHING actions into a partitioned table.
ExecInitPartitionInfo() duplicates much of the logic in ExecInitMerge(), except that it failed to handle DO NOTHING actions. This would cause an "unknown action in MERGE WHEN clause" error if a MERGE with any DO NOTHING actions attempted to insert into a partition not already initialised by ExecInitModifyTable(). Bug: #18871 Reported-by: Alexander Lakhin <exclusion@gmail.com> Author: Tender Wang <tndrwang@gmail.com> Reviewed-by: Gurjeet Singh <gurjeet@singh.im> Discussion: https://postgr.es/m/18871-b44e3c96de3bd2e8%40postgresql.org Backpatch-through: 15
This commit is contained in:
@@ -876,7 +876,7 @@ ExecInitPartitionInfo(ModifyTableState *mtstate, EState *estate,
|
||||
* reference and make copy for this relation, converting stuff that
|
||||
* references attribute numbers to match this relation's.
|
||||
*
|
||||
* This duplicates much of the logic in ExecInitMerge(), so something
|
||||
* This duplicates much of the logic in ExecInitMerge(), so if something
|
||||
* changes there, look here too.
|
||||
*/
|
||||
if (node && node->operation == CMD_MERGE)
|
||||
@@ -956,6 +956,8 @@ ExecInitPartitionInfo(ModifyTableState *mtstate, EState *estate,
|
||||
NULL);
|
||||
break;
|
||||
case CMD_DELETE:
|
||||
case CMD_NOTHING:
|
||||
/* Nothing to do */
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Reference in New Issue
Block a user