pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Pg Hackers <pgsql-hackers@lists.postgresql.org>
Subject: propagating replica identity to partitions
Date: Mon, 4 Feb 2019 13:30:41 -0300
Message-ID: <201902041630.gpadougzab7v@alvherre.pgsql> (raw)

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




view thread (37+ messages)  latest in thread

Message-ID: <201902041630.gpadougzab7v@alvherre.pgsql>
Permalink:  ../201902041630.gpadougzab7v@alvherre.pgsql/
Also on:    postgresql.org/message-id/201902041630.gpadougzab7v@alvherre.pgsql

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@2ndquadrant.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: propagating replica identity to partitions
  In-Reply-To: <201902041630.gpadougzab7v@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox