agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
From: Antonin Houska <ah@cybertec.at>
To: Alvaro Herrera <alvherre@kurilemu.de>
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: Thu, 10 Sep 2026 20:09:56 +0200
Message-ID: <45513.1789063796@localhost> (raw)
In-Reply-To: <aqKC6K_QO0OEv3gy@alvherre.pgsql>
References: <aqKC6K_QO0OEv3gy@alvherre.pgsql>

Alvaro Herrera <alvherre@kurilemu.de> wrote:

> On 2026-Sep-01, Alvaro Herrera wrote:
> 
> > 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.
> 
> Actually, wouldn't it make more sense to reset the replica identity back
> to 'd' when the index is dropped, as in the attached patch?

Even though users probably do not drop the identity index too often, I think
it's possible that someone tries to drop an index that seems to be
unnecessary, but forgets that it's in use by logical replication. In such
case, I tend to consider ERROR better response than broken replication.

-- 
Antonin Houska
Web: https://www.cybertec-postgresql.com






view thread (12+ messages)  latest in thread

Message-ID: <45513.1789063796@localhost>
Permalink:  ../45513.1789063796@localhost/
Also on:    postgresql.org/message-id/45513.1789063796@localhost

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: ah@cybertec.at, alvherre@kurilemu.de, 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: <45513.1789063796@localhost>

* 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