Re: BUG #17579: 15beta2: strange error when trying to use MERGE statement as a CTE - Mailing list pgsql-bugs

From Richard Guo
Subject Re: BUG #17579: 15beta2: strange error when trying to use MERGE statement as a CTE
Date
Msg-id CAMbWs4-Zdeq+0c3npMGihZbGztR8WvWMs7XuSqKp8OLeg3HHOA@mail.gmail.com
Whole thread Raw
In response to Re: BUG #17579: 15beta2: strange error when trying to use MERGE statement as a CTE  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #17579: 15beta2: strange error when trying to use MERGE statement as a CTE
List pgsql-bugs

On Mon, Aug 8, 2022 at 10:21 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
It evidently wasn't ever *tested*, but in principle I think it ought
to work.  I'm not sure how much effort will be involved to make that
happen.  At this point we might have to disallow it for v15 and
come back to the problem later.

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.

+1 to disallow it for now.

Thanks
Richard 

pgsql-bugs by date:

Previous
From: Alexander Pyhalov
Date:
Subject: Re: foreign join error "variable not found in subplan target list"
Next
From: David Turoň
Date:
Subject: Re: BUG #17206: the function array_cat(anyarray, anyarray) does not exist