Re: Proposal to allow DELETE/UPDATE on partitioned tables with unsupported foreign partitions - Mailing list pgsql-hackers

From Shirisha Shirisha
Subject Re: Proposal to allow DELETE/UPDATE on partitioned tables with unsupported foreign partitions
Date
Msg-id CAP3-t08DEZ+isXbWXBuJR9KDgbO=wyCg2po90kDAB62Z4YghZw@mail.gmail.com
Whole thread Raw
In response to Re: Proposal to allow DELETE/UPDATE on partitioned tables with unsupported foreign partitions  (Etsuro Fujita <etsuro.fujita@gmail.com>)
Responses Re: Proposal to allow DELETE/UPDATE on partitioned tables with unsupported foreign partitions
List 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.fujita@gmail.com> wrote:
On Mon, Jul 7, 2025 at 6:46 PM Shirisha Shirisha
<shirisha.sn@broadcom.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

pgsql-hackers by date:

Previous
From: Ilia Evdokimov
Date:
Subject: Re: Use merge-based matching for MCVs in eqjoinsel
Next
From: Bruce Momjian
Date:
Subject: REPACK and naming