]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix MERGE with DO NOTHING actions into a partitioned table.
authorDean Rasheed <dean.a.rasheed@gmail.com>
Sat, 29 Mar 2025 09:52:18 +0000 (09:52 +0000)
committerDean Rasheed <dean.a.rasheed@gmail.com>
Sat, 29 Mar 2025 09:52:18 +0000 (09:52 +0000)
commit14a33d3f0ae6dcbe9b91d33f64b795c2aef6a870
tree20f1861efa70fbcca348ded79000dee1ff004d7b
parent0e86bad380997b3b6d39191df31ad7c1945ab389
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
src/backend/executor/execPartition.c
src/backend/executor/nodeModifyTable.c
src/test/regress/expected/merge.out
src/test/regress/sql/merge.sql