From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Richard Guo <guofenglinux@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: borz_off@cs.msu.su, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #17579: 15beta2: strange error when trying to use MERGE statement as a CTE
Date: Thu, 11 Aug 2022 13:40:20 +0200
Message-ID: <20220811114020.li7sp32bxqsnlx7n@alvherre.pgsql> (raw)
In-Reply-To: <CAMbWs4-Zdeq+0c3npMGihZbGztR8WvWMs7XuSqKp8OLeg3HHOA@mail.gmail.com>
On 2022-Aug-11, Richard Guo wrote:
> Seems we neglect to think of MERGE statements when we transform WITH
> clauses and when we rewrite the query. If we add the check against MERGE
> statement in parse_cte.c and in rewriteHandler.c, the query in problem
> can work. But I'm not sure if that's enough.
I would like to have MERGE within CTEs, but I think for it to be truly
useful we need a RETURNING clause, which is currently not implemented.
I don't think it's terribly difficult to implement ... AFAICS most of
the pieces are there ... but clearly out of scope for pg15.
> +1 to disallow it for now.
This patch does that.
--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/Attachments:
0001-Reject-MERGE-in-CTE.patch (text/x-diff, 0B) download
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: alvherre@alvh.no-ip.org, guofenglinux@gmail.com, tgl@sss.pgh.pa.us, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17579: 15beta2: strange error when trying to use MERGE statement as a CTE
In-Reply-To: <20220811114020.li7sp32bxqsnlx7n@alvherre.pgsql>
* 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