agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@kurilemu.de>
To: Antonin Houska <ah@cybertec.at>
Cc: Chao Li <li.evan.chao@gmail.com>
Cc: Matthias van de Meent <boekewurm+postgres@gmail.com>
Cc: Nathan Bossart <nathandbossart@gmail.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: REPACK (CONCURRENTLY) fails when replica identity index is dropped
Date: Tue, 1 Sep 2026 19:53:17 +0200
Message-ID: <apcP281A4ta2FToT@alvherre.pgsql> (raw)
In-Reply-To: <30425.1788257444@localhost>

On 2026-Sep-01, Antonin Houska wrote:

> I agree that the core issue is that we allow dropping an index that is being
> used as replica identity.
>
> Regarding catalog entries already broken this way, it appears that pg_upgrade
> fixes them because pg_dump does not issue "ALTER TABLE ... REPLICA IDENTITY
> USING INDEX ..." if there is not identity index. Thus after pg_restore,
> pg_class(relreplident) becomes REPLICA_IDENTITY_DEFAULT.

I agree that disallowing the drop is a sensible thing to do.  I don't
think such a behavioral change is backpatchable though, so let's confine
us to pg19.  The finding that pg_upgrade doesn't preserve the broken
state is good, because we don't have to handle it in any particular way.

I think the proposed implementation is flawed though, because the index
might be dropped indirectly (maybe an opclass or extension is dropped
CASCADE).  I think it should happen somewhere in performDeletion() and
friends, which is to say it should happen during doDeletion(), thus the
check should be in index_drop().

Thanks

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
"Before you were born your parents weren't as boring as they are now. They
got that way paying your bills, cleaning up your room and listening to you
tell them how idealistic you are."  -- Charles J. Sykes' advice to teenagers






view thread (12+ messages)  latest in thread

Message-ID: <apcP281A4ta2FToT@alvherre.pgsql>
Permalink:  ../apcP281A4ta2FToT@alvherre.pgsql/
Also on:    postgresql.org/message-id/apcP281A4ta2FToT@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@kurilemu.de, ah@cybertec.at, li.evan.chao@gmail.com, boekewurm+postgres@gmail.com, nathandbossart@gmail.com
  Subject: Re: REPACK (CONCURRENTLY) fails when replica identity index is dropped
  In-Reply-To: <apcP281A4ta2FToT@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox