Re: tablecmds: fix bug where index rebuild loses replica identity on partitions

From: "Alberto Piai" <alberto(dot)piai(at)gmail(dot)com>
To: "Chao Li" <li(dot)evan(dot)chao(at)gmail(dot)com>, "Alberto Piai" <alberto(dot)piai(at)gmail(dot)com>
Cc: "Sami Imseih" <samimseih(at)gmail(dot)com>, "Postgres hackers" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "Xuneng Zhou" <xunengzhou(at)gmail(dot)com>, "Michael Paquier" <michael(at)paquier(dot)xyz>, "Robert Treat" <rob(at)xzilla(dot)net>
Subject: Re: tablecmds: fix bug where index rebuild loses replica identity on partitions
Date: 2026-07-31 11:21:32
Message-ID: DKCPTOUWSN8G.ZOEE18C6M6QE@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue Jul 28, 2026 at 10:46 AM CEST, Chao Li wrote:
> Thanks for your review and suggestion. I think your analysis is correct, and your suggested direction sounds reasonable. However, the current ALTER TABLE infra doesn't seem well suited to it. ATPostAlterTypeCleanup() for the parent calls performMultipleDeletions(), which also deletes the dependent child partition indexes, while DefineIndex() for the parent automatically recreates the parent index and all child indexes.

Just to wrap up this branch of the thread: I experimented a bit with
"unlinking" the partitions by removing their pg_depend records to
prevent the recursive drop. I agree that going this way would require a
sinificant change – or at least I couldn't see a simple way to make this
happen.

Your approach is better, I will add my review on the latest version of
the patch.

Regards,

Alberto

--
Alberto Piai
Sensational AG
Zürich, Switzerland

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alberto Piai 2026-07-31 11:22:21 Re: tablecmds: fix bug where index rebuild loses replica identity on partitions
Previous Message Vladlen Popolitov 2026-07-31 11:13:23 Re: [PATCH v1] add SQL type INT16 based on int128