On Wed, 5 Feb 2025 at 14:14, Álvaro Herrera <alvhe...@alvh.no-ip.org> wrote: > > 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. > I have created a patch with the above approach. We can create a publication on a partition table with foreign partition when publish_via_partition_root=false. In this case foreign partitions will not be published. And if publish_via_partition_root=true we will throw an error. Please find the v5 patch.
> 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. > I have handled the above cases and added tests for the same. > (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.) > Thanks and Regards, Shlok Kyal
v5-0001-Restrict-publishing-of-partitioned-table-with-for.patch
Description: Binary data