Re: [BUG] Query with postgres fwd deletes more tuples than it should

From: Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>
To: jiaoshuntian(at)highgo(dot)com
Cc: Daniil Davydov <3danissimo(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [BUG] Query with postgres fwd deletes more tuples than it should
Date: 2025-09-17 11:46:02
Message-ID: CAPmGK15YhzB1Xjs4-JmCe6rJjC_3LVZ9=JfYRPL8ow_JPx+CrQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Sep 17, 2025 at 2:46 PM <jiaoshuntian(at)highgo(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Burd 2025-09-17 11:59:15 Re: [PATCH] Add tests for Bitmapset
Previous Message Amit Kapila 2025-09-17 11:44:26 Re: How can end users know the cause of LR slot sync delays?