public inbox for pgsql-bugs@postgresql.orghelp / color / mirror / Atom feed
BUG #19462: MERGE on partitioned table with INSERT DEFAULT VALUES fails with "unknown action in MERGE WHEN clau 2+ messages / 2 participants [nested] [flat]
* BUG #19462: MERGE on partitioned table with INSERT DEFAULT VALUES fails with "unknown action in MERGE WHEN clau @ 2026-04-20 09:34 PG Bug reporting form <noreply@postgresql.org> 2026-05-17 20:21 ` Re: BUG #19462: MERGE on partitioned table with INSERT DEFAULT VALUES fails with "unknown action in MERGE WHEN clau Álvaro Herrera <alvherre@kurilemu.de> 0 siblings, 1 reply; 2+ messages in thread From: PG Bug reporting form @ 2026-04-20 09:34 UTC (permalink / raw) To: pgsql-bugs@lists.postgresql.org; +Cc: 303677365@qq.com The following bug has been logged on the website: Bug reference: 19462 Logged by: chunling qin Email address: 303677365@qq.com PostgreSQL version: 15.0 Operating system: centos Description: ## Summary A MERGE statement targeting a partitioned table fails with `ERROR: unknown action in MERGE WHEN clause` when the NOT MATCHED clause uses `INSERT DEFAULT VALUES`. ## PostgreSQL Version ``` PostgreSQL 15devel on x86_64-pc-linux-gnu, compiled by clang version 17.0.6, 64-bit ``` Tested on REL_15_STABLE branch. ## Steps to Reproduce ```sql -- Setup: Create partitioned target table CREATE TABLE pmerge_tgt (id INT) PARTITION BY RANGE (id); CREATE TABLE pmerge_tgt_lo PARTITION OF pmerge_tgt FOR VALUES FROM (MINVALUE) TO (100); CREATE TABLE pmerge_tgt_hi PARTITION OF pmerge_tgt FOR VALUES FROM (100) TO (MAXVALUE); CREATE TABLE pmerge_tgt_def PARTITION OF pmerge_tgt DEFAULT; -- Create source table CREATE TABLE pmerge_src (id INT); -- Insert test data INSERT INTO pmerge_tgt VALUES (50); INSERT INTO pmerge_src VALUES (200); -- Bug reproduction MERGE INTO pmerge_tgt t USING pmerge_src s ON t.id > 1000 WHEN MATCHED THEN DO NOTHING WHEN NOT MATCHED THEN INSERT DEFAULT VALUES; ``` This issue could not be reproduced with the latest version, but we can easily reproduced by PostgreSQL 15devel. I am submitting this report for official confirmation. -- Bug reproduction MERGE INTO pmerge_tgt t USING pmerge_src s ON t.id > 1000 WHEN MATCHED THEN DO NOTHING WHEN NOT MATCHED THEN INSERT DEFAULT VALUES;ERROR: relation "pmerge_tgt" already exists postgres=# ERROR: relation "pmerge_tgt_lo" already exists postgres=# ERROR: relation "pmerge_tgt_hi" already exists postgres=# ERROR: relation "pmerge_tgt_def" already exists postgres=# postgres=# postgres=# ERROR: relation "pmerge_src" already exists postgres=# postgres=# postgres=# INSERT 0 1 postgres=# INSERT 0 1 postgres=# postgres=# postgres=# postgres-# postgres-# ERROR: unknown action in MERGE WHEN clause ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #19462: MERGE on partitioned table with INSERT DEFAULT VALUES fails with "unknown action in MERGE WHEN clau 2026-04-20 09:34 BUG #19462: MERGE on partitioned table with INSERT DEFAULT VALUES fails with "unknown action in MERGE WHEN clau PG Bug reporting form <noreply@postgresql.org> @ 2026-05-17 20:21 ` Álvaro Herrera <alvherre@kurilemu.de> 0 siblings, 0 replies; 2+ messages in thread From: Álvaro Herrera @ 2026-05-17 20:21 UTC (permalink / raw) To: 303677365@qq.com; pgsql-bugs@lists.postgresql.org On 2026-Apr-20, PG Bug reporting form wrote: Hello chunling qin, > ``` > PostgreSQL 15devel on x86_64-pc-linux-gnu, compiled by clang version 17.0.6, > 64-bit > ``` > Tested on REL_15_STABLE branch. Hmm, this is quite an ancient version of 15, right? I tried your script in 15.18 and AFAICT it works correctly. Thanks, -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ "Puedes vivir sólo una vez, pero si lo haces bien, una vez es suficiente" ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2026-05-17 20:21 UTC | newest] Thread overview: 2+ messages (download: mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-04-20 09:34 BUG #19462: MERGE on partitioned table with INSERT DEFAULT VALUES fails with "unknown action in MERGE WHEN clau PG Bug reporting form <noreply@postgresql.org> 2026-05-17 20:21 ` Álvaro Herrera <alvherre@kurilemu.de>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox