From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: borz_off@cs.msu.su
Subject: BUG #17579: 15beta2: strange error when trying to use MERGE statement as a CTE
Date: Sun, 07 Aug 2022 21:44:25 +0000
Message-ID: <17579-82482cd7b267b862@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 17579
Logged by: Alexey Borzov
Email address: borz_off@cs.msu.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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, borz_off@cs.msu.su
Subject: Re: BUG #17579: 15beta2: strange error when trying to use MERGE statement as a CTE
In-Reply-To: <17579-82482cd7b267b862@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox