[PATCH] Skip unpublishable child tables when adding parent to publication - Mailing list pgsql-hackers

From Arunprasad Rajkumar
Subject [PATCH] Skip unpublishable child tables when adding parent to publication
Date
Msg-id CACDxuFwsCHyWvbfcrw9-WxFeDcvyz2KF-aTZaHaB6d-LnbxE6Q@mail.gmail.com
Whole thread Raw
List pgsql-hackers
Hi,

I would like to propose a patch that improves the handling of table inheritance
hierarchies when adding tables to publications for logical replication.

Problem: 
Currently, when attempting to add a parent table to a publication using, the operation fails 
with an error if any of the inherited child tables are foreign tables, temporary tables, or unlogged tables. This makes it difficult to work with inheritance hierarchies in logical
replication scenarios, as users must manually manage which specific tables to
include or exclude.

Proposed Solution:
This patch modifies the behavior to automatically skip child tables that cannot
be replicated, rather than failing the entire operation. When unpublishable
children are encountered, a NOTICE message is issued following the same format
used by VACUUM and ANALYZE commands:

  NOTICE: skipping "table_name" --- cannot add relation to publication
  DETAIL: Foreign tables cannot be replicated.

The parent table and any publishable children are successfully added to the
publication.

I've attached the patch for review. Any feedback or suggestions for improvement
would be greatly appreciated.

Best regards,
Arun
Attachment

pgsql-hackers by date:

Previous
From: Etsuro Fujita
Date:
Subject: Re: Import Statistics in postgres_fdw before resorting to sampling.
Next
From: Bertrand Drouvot
Date:
Subject: Re: Mark function arguments of type "T *" as "const T *" where possible