BUG #17579: 15beta2: strange error when trying to use MERGE statement as a CTE

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: borz_off(at)cs(dot)msu(dot)su
Subject: BUG #17579: 15beta2: strange error when trying to use MERGE statement as a CTE
Date: 2022-08-07 21:44:25
Message-ID: 17579-82482cd7b267b862@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 17579
Logged by: Alexey Borzov
Email address: borz_off(at)cs(dot)msu(dot)su
PostgreSQL version: Unsupported/Unknown
Operating system: Windows
Description:

create table foo (id int);

with cte_failure as (
merge into foo as target
using foo as source
on target.id = source.id
when matched then do nothing
)
select 'fail!';

When executing the above code I get the following error:

> ERROR: DO INSTEAD NOTIFY rules are not supported for data-modifying
statements in WITH

I suspect that MERGE was never intended to work as a CTE, but right now the
grammar allows any PreparableStmt in a common_table_expr and the above error
is triggered a lot later due to implementation details.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kyotaro Horiguchi 2022-08-08 02:07:53 Re: BUG #17577: pg_ctl promote is not preemptive in archive recovery
Previous Message PG Bug reporting form 2022-08-05 21:16:57 BUG #17578: undetected (on one side) deadlock with reindex CONCURRENTLY partitioned index vs drop index