Re: MERGE issues around inheritance

From: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Subject: Re: MERGE issues around inheritance
Date: 2025-05-24 09:10:44
Message-ID: 202505240910.vsg6z2dr2ou3@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2025-May-21, Andres Freund wrote:

> Hi,
>
> In [1] I added some verification to projection building, to check if the
> tupleslot passed to ExecBuildProjectionInfo() is compatible with the target
> list. One query in merge.sql [2] got flagged.
>
> Trying to debug that issue, I found another problem. This leaves us with:
>
> 1) w/ inheritance INSERTed rows are not returned by RETURNING. This seems to
> just generally not work with MERGE

Hmm, curious. One thing to observe is that the original source tuple is
in the child table, but the tuple inserted by MERGE ends up in the
parent table. I'm guessing that the code gets confused as to the
relation that the tuple in the returned slot comes from, and that
somehow makes it somehow not "see" the tuple to process for RETURNING?
I dunno. CC'ing Dean, who is more familiar with this code than I am.

--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
"I love the Postgres community. It's all about doing things _properly_. :-)"
(David Garamond)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2025-05-24 09:24:26 Re: mention unused_oids script in pg_proc.dat
Previous Message André Verwijs 2025-05-24 07:22:59 Testing PostgreSQL 18 beta ...