Re: Restrict publishing of partitioned table with a foreign table as partition

From: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: vignesh C <vignesh21(at)gmail(dot)com>
Cc: Sergey Tatarintsev <s(dot)tatarintsev(at)postgrespro(dot)ru>, Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Restrict publishing of partitioned table with a foreign table as partition
Date: 2025-02-05 08:44:40
Message-ID: 202502050844.4lrgg3aoudat@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2025-Feb-05, vignesh C wrote:

> We can maintain the behavior you suggested when the
> PUBLISH_VIA_PARTITION_ROOT option is set to false. However, when
> PUBLISH_VIA_PARTITION_ROOT is true, the table data is copied from the
> root table (as intended by the user), which will also include the
> foreign table data. In this case, wouldn’t it be better to throw an
> error?

It sounds to me a reasonable restriction that you can only add a
partitioned table to a publication if publish_via_partition_root=false.
Then the case of hybrid partitioned tables is supported, but it requires
that changes are published directly by partitions, which is sensible
anyway.

In this case, during CREATE FOREIGN TABLE of a partition with this
condition, we must check whether any publications include the schema
that the table is being created on (or attached, for ALTER TABLE ATTACH
PARTITION), and whether there are any publications that are FOR ALL
TABLES that would be affected.

(If we later figure out a way to allow publish_via_partition_root and
skip the tuples in foreign partitions, it's easy to remove the
restriction.)

--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"That sort of implies that there are Emacs keystrokes which aren't obscure.
I've been using it daily for 2 years now and have yet to discover any key
sequence which makes any sense." (Paul Thomas)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2025-02-05 08:46:30 Re: Commitfest app release on Feb 17 with many improvements
Previous Message Japin Li 2025-02-05 08:32:30 Re: [RFC] Lock-free XLog Reservation from WAL