pgsql: Fix MERGE with DO NOTHING actions into a partitioned table.

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix MERGE with DO NOTHING actions into a partitioned table.
Date: 2025-03-29 10:00:30
Message-ID: E1tySzO-001ZH1-19@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(at)gmail(dot)com>
Author: Tender Wang <tndrwang(at)gmail(dot)com>
Reviewed-by: Gurjeet Singh <gurjeet(at)singh(dot)im>
Discussion: https://postgr.es/m/18871-b44e3c96de3bd2e8%40postgresql.org
Backpatch-through: 15

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8b6a0e2392b9fc3f9b821da705797bb54c982dc1

Modified Files
--------------
src/backend/executor/execPartition.c | 4 +++-
src/backend/executor/nodeModifyTable.c | 2 +-
src/test/regress/expected/merge.out | 17 +++++++++++++++++
src/test/regress/sql/merge.sql | 13 +++++++++++++
4 files changed, 34 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tomas Vondra 2025-03-29 14:19:56 pgsql: Fix grammar in GIN README
Previous Message Peter Eisentraut 2025-03-29 09:54:40 pgsql: Use PRI?64 instead of "ll?" in format strings (continued).