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

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, borz_off(at)cs(dot)msu(dot)su, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #17579: 15beta2: strange error when trying to use MERGE statement as a CTE
Date: 2022-08-11 11:40:20
Message-ID: 20220811114020.li7sp32bxqsnlx7n@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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/

Attachment Content-Type Size
0001-Reject-MERGE-in-CTE.patch text/x-diff 2.2 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2022-08-11 13:37:08 Re: BUG #17579: 15beta2: strange error when trying to use MERGE statement as a CTE
Previous Message PG Bug reporting form 2022-08-11 11:40:03 BUG #17581: DB Restriction Option Is Not Working