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

From: Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>
To: Shirisha Shirisha <shirisha(dot)sn(at)broadcom(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-07-09 11:36:37
Message-ID: CAPmGK14HzW8V95Wj0qvDTfc0Xk-8Krbxi5nR=1Znxvoft2H=eQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message Zechman, Derek S 2025-07-09 11:30:22 RE: analyze-in-stages post upgrade questions