propagating replica identity to partitions - Mailing list pgsql-hackers

From Alvaro Herrera
Subject propagating replica identity to partitions
Date
Msg-id 201902041630.gpadougzab7v@alvherre.pgsql
Whole thread Raw
Responses Re: propagating replica identity to partitions  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Re: propagating replica identity to partitions  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Hello

If you do ALTER TABLE .. REPLICA IDENTITY to a partitioned table, the
command operates on the parent table itself and does not propagate to
partitions.  Why is this?  Maybe not recursing was the right call when
we only had regular inheritance (back in 9.4), but since partitioned
tables got introduced, I think it is completely the other way around:
not recursing is an usability fail.

At the same time, I think that psql failing to display the replica
identity for partitioned tables is just an oversight and not designed
in.

I propose to change the behavior to:

1. When replica identity is changed on a partitioned table, all partitions
   are updated also.  Do we need to care about regular inheritance?
   My inclination is not to touch those; this'd become the first case
   in ATPrepCmd that recurses on partitioning but not inheritance.

2. When a partition is created, the replica identity is set to the
   same that the parent table has.  If it's type index, figure out the
   corresponding index in the partition, set that.  If the index doesn't
   exist, raise an error (i.e. replica identity cannot be set to an
   index until it has propagated to all children).

3. psql should display replica identity for partitioned tables.

Thoughts?

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


pgsql-hackers by date:

Previous
From: Alexey Kondratov
Date:
Subject: Re: Too rigorous assert in reorderbuffer.c
Next
From: Andres Freund
Date:
Subject: Memory contexts reset for trigger invocations