propagating replica identity to partitions

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: propagating replica identity to partitions
Date: 2019-02-04 16:30:41
Message-ID: 201902041630.gpadougzab7v@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2019-02-04 16:44:17 Memory contexts reset for trigger invocations
Previous Message Alexey Kondratov 2019-02-04 16:15:14 Re: Too rigorous assert in reorderbuffer.c