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

2025-09-20 Thread Daniil Davydov
Hi, If we create foreign table (via postgres_fdw) on a partitioned table, queries that don't use "direct modify" will delete too many tuples because of invalid "WHERE" clause. Please, see this script : -- CREATE DATABASE remote; CREATE DATABASE test; \c remote -- create partitioned table with t

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

2025-09-18 Thread Etsuro Fujita
On Wed, Sep 17, 2025 at 10:11 PM Daniil Davydov <3daniss...@gmail.com> wrote: > On Wed, Sep 17, 2025 at 6:46 PM Etsuro Fujita wrote: > > On Wed, Sep 17, 2025 at 2:46 PM wrote: > > > I think a good way to fix would be to use `(tableoid, ctid)` together as > > > the row > > > identifier in row-by-

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

2025-09-17 Thread Daniil Davydov
Hi, On Wed, Sep 17, 2025 at 6:46 PM Etsuro Fujita wrote: > > On Wed, Sep 17, 2025 at 2:46 PM 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 pr

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

2025-09-17 Thread Etsuro Fujita
On Wed, Sep 17, 2025 at 2:46 PM 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

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

2025-09-16 Thread jiaoshuntian
Hi, I can reproduce the same issue using the script you provided. 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 su