Re: [BUG] Query with postgres fwd deletes more tuples than it should - Mailing list pgsql-hackers

From Daniil Davydov
Subject Re: [BUG] Query with postgres fwd deletes more tuples than it should
Date
Msg-id CAJDiXghD7rSZE+Nz=gOp75PJB63K_y-SEQXyf9z26r3kZFGbNw@mail.gmail.com
Whole thread Raw
In response to Re: [BUG] Query with postgres fwd deletes more tuples than it should  (Etsuro Fujita <etsuro.fujita@gmail.com>)
Responses Re: [BUG] Query with postgres fwd deletes more tuples than it should
List pgsql-hackers
Hi,

On Wed, Sep 17, 2025 at 6:46 PM Etsuro Fujita <etsuro.fujita@gmail.com> wrote:
>
> On Wed, Sep 17, 2025 at 2:46 PM <jiaoshuntian@highgo.com> wrote:
> > I can reproduce the same issue using the script you provided.
>
> This is a known bug.  See discussions in [1], where I proposed a
> simple fix for it that disables foreign modifications in problematic
> cases as shown by Daniil.
>

Thanks! Somehow I overlooked it.

> > I think a good way to fix would be to use `(tableoid, ctid)` together as the row
> > identifier in row-by-row updates/deletes. This combination is unique
> > across partitions and avoids the incorrect behavior, while still keeping
> > LIMIT support.
>
> Agreed; actually I created such a fix as well a long time ago, but
> unfortunately it has many issues...

I'll try to help with implementation of the proposed idea.

BTW, maybe we should move commitfest entry [1] to the next CF?

[1] https://commitfest.postgresql.org/patch/1819/
--
Best regards,
Daniil Davydov



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: REPACK and naming
Next
From: "David G. Johnston"
Date:
Subject: REPACK and naming