On Thu, Dec 11, 2025 at 2:46 PM Chao Li <[email protected]> wrote: > > Hi, > While working with logical replication and partitioned tables, I noticed an > inconsistency between how publications treat partitions and how "ALTER TABLE > ... REPLICA IDENTITY" behaves. > > When a publication is created on a partitioned table, e.g.: > ``` > CREATE PUBLICATION pub FOR TABLE parent; > ``` > > PostgreSQL automatically includes all leaf partitions of the table in the > publication. This matches the user’s expectation that a partitioned table > behaves as a single logical entity. > > However, if the user then runs: > ``` > ALTER TABLE parent REPLICA IDENTITY FULL; > ``` > only the parent table’s relreplident is updated. None of the leaf partitions > inherit this change, even though the parent itself has no storage and its > replication identity plays no role in logical replication. Logical decoding > always operates on the leaf partitions, and their replication identities > determine whether UPDATE/DELETE can be replicated safely. > > This gap leads to several problems: > > * The parent table’s replica identity is effectively irrelevant during > logical replication, since it never stores tuples or produces WAL. >
When we use row filters, if publish_via_partition_root option of publication is true, the root partitioned table's row filter is used. I think this would then refer RI of partitioned table for validity of row filter. Please see docs [1] (There can be a case where a subscription combines multiple publications. If a partitioned table is published by any subscribed publications which set publish_via_partition_root = true, changes on this partitioned table (or on its partitions) will be published using the identity and schema of this partitioned table rather than that of the individual partitions. This parameter also affects how row filters and column lists are chosen for partitions; see below for details.) for more details. I have not tested it but you can once try to see how it behaves. The other point is what if one of the partition already has RI defined to a different value than what is defined for parent table? [1] - https://www.postgresql.org/docs/devel/sql-createpublication.html -- With Regards, Amit Kapila.
