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

From Etsuro Fujita
Subject Re: [BUG] Query with postgres fwd deletes more tuples than it should
Date
Msg-id CAPmGK15YhzB1Xjs4-JmCe6rJjC_3LVZ9=JfYRPL8ow_JPx+CrQ@mail.gmail.com
Whole thread Raw
In response to Re: [BUG] Query with postgres fwd deletes more tuples than it should  (jiaoshuntian@highgo.com)
Responses Re: [BUG] Query with postgres fwd deletes more tuples than it should
List pgsql-hackers
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.

> 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...

Best regards,
Etsuro Fujita

[1] https://www.postgresql.org/message-id/flat/20250718175314.4513c00a%40karst



pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: How can end users know the cause of LR slot sync delays?
Next
From: Greg Burd
Date:
Subject: Re: [PATCH] Add tests for Bitmapset