Re: Proposal to allow DELETE/UPDATE on partitioned tables with unsupported foreign partitions

From: Shirisha Shirisha <shirisha(dot)sn(at)broadcom(dot)com>
To: Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, Ashwin Agrawal <ashwin(dot)agrawal(at)broadcom(dot)com>, Ashwin Agrawal <ashwinstar(at)gmail(dot)com>
Subject: Re: Proposal to allow DELETE/UPDATE on partitioned tables with unsupported foreign partitions
Date: 2025-09-16 16:37:48
Message-ID: CAP3-t08DEZ+isXbWXBuJR9KDgbO=wyCg2po90kDAB62Z4YghZw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks Etsuro for the review comments.
I've addressed all of them in this updated patch:

- Rebased the patch on the latest changes
- Added support for inherited foreign tables
- Moved the regression test to file_fdw
- Added test for inherited foreign tables

Please find the updated patch attached.
CommitFest link - https://commitfest.postgresql.org/patch/5901

Thanks and Regards,
Shirisha
Broadcom Inc.

On Wed, Jul 9, 2025 at 5:06 PM Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>
wrote:

> On Mon, Jul 7, 2025 at 6:46 PM Shirisha Shirisha
> <shirisha(dot)sn(at)broadcom(dot)com> wrote:
> > > Did you add the patch to the CommitFest App?
> >
> > Yes, I had attempted to register the patch earlier but had to wait for
> the cool-off period to pass for my newly created account.
> >
> > I’ve now successfully registered the patch on the CommitFest app
> > https://commitfest.postgresql.org/patch/5901
>
> Thanks for that. I tested/reviewed the patch quickly.
>
> The patch does not work well with table inheritance:
>
> create table pt (a text, b int);
> insert into pt values ('AAA', 42);
> create foreign table ft (a text, b int) server file_server OPTIONS
> (filename 'path-to-file', format 'csv', delimiter ',');
> select * from ft;
> a | b
> -----+----
> BBB | 42
> (1 row)
>
> alter foreign table ft inherit pt;
> update pt set b = b + 1000 where a = 'AAA';
> ERROR: cannot update foreign table "ft"
>
> Why doesn't the patch cover this case?
>
> --- a/src/test/regress/sql/partition_info.sql
> +++ b/src/test/regress/sql/partition_info.sql
> @@ -127,3 +127,31 @@ SELECT pg_partition_root('ptif_li_child');
> DROP VIEW ptif_test_view;
> DROP MATERIALIZED VIEW ptif_test_matview;
> DROP TABLE ptif_li_parent, ptif_li_child;
> +
> +-- Test UPDATE/DELETE on partition table with foreign partitions
> +\getenv abs_srcdir PG_ABS_SRCDIR
> +CREATE EXTENSION file_fdw;
> +CREATE SERVER file_server FOREIGN DATA WRAPPER file_fdw;
>
> I think the regression tests should be moved to file_fdw.
>
> That is it. I will do the rest of the review in Commitfest PG19-2 (as
> this was registered for it).
>
> Best regards,
> Etsuro Fujita
>

Attachment Content-Type Size
v2-0001-Allow-DELETE-UPDATE-on-tables-with-foreign-partit.patch application/octet-stream 15.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2025-09-16 16:40:46 REPACK and naming
Previous Message Ilia Evdokimov 2025-09-16 15:52:47 Re: Use merge-based matching for MCVs in eqjoinsel