Re: MERGE lacks ruleutils.c decompiling support!?

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: MERGE lacks ruleutils.c decompiling support!?
Date: 2023-05-05 16:21:30
Message-ID: 20230505162130.jcotfjoklniro2iq@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2023-May-05, Tom Lane wrote:

> I made this function:
>
> CREATE OR REPLACE FUNCTION test_fun()
> RETURNS void
> LANGUAGE SQL
> BEGIN ATOMIC
> MERGE INTO target
> USING source s on s.id = target.id
> WHEN MATCHED THEN
> UPDATE SET data = s.data
> WHEN NOT MATCHED THEN
> INSERT VALUES (s.id, s.data);
> end;
>
> It appears to work fine, but:
>
> regression=# \sf+ test_fun()
> ERROR: unrecognized query command type: 5
>
> and it also breaks pg_dump. Somebody screwed up pretty badly
> here. Is there any hope of fixing it for Monday's releases?
>
> (I'd guess that decompiling the WHEN clause would take a nontrivial
> amount of new code, so maybe fixing it on such short notice is
> impractical. But ugh.)

Hmm, there is *some* code in ruleutils for MERGE, but clearly something
is missing. Let me have a look ...

--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2023-05-05 16:42:25 First draft of back-branch release notes is done
Previous Message Anton Kirilov 2023-05-05 15:02:24 Re: Add PQsendSyncMessage() to libpq