[PATCH] Skip unpublishable child tables when adding parent to publication

From: Arunprasad Rajkumar <ar(dot)arunprasad(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: [PATCH] Skip unpublishable child tables when adding parent to publication
Date: 2025-12-12 14:26:10
Message-ID: CACDxuFwsCHyWvbfcrw9-WxFeDcvyz2KF-aTZaHaB6d-LnbxE6Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
0001-Skip-unpublishable-child-tables-when-adding-parent-t.patch application/octet-stream 8.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bertrand Drouvot 2025-12-12 14:33:39 Re: Mark function arguments of type "T *" as "const T *" where possible
Previous Message Etsuro Fujita 2025-12-12 14:04:26 Re: Import Statistics in postgres_fdw before resorting to sampling.