Re: REPACK (CONCURRENTLY) fails when replica identity index is dropped

From: Antonin Houska <ah(at)cybertec(dot)at>
To: Alvaro Herrera <alvherre(at)kurilemu(dot)de>
Cc: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: REPACK (CONCURRENTLY) fails when replica identity index is dropped
Date: 2026-09-10 18:09:56
Message-ID: 45513.1789063796@localhost
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera <alvherre(at)kurilemu(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Osama Abdul Qader 2026-09-10 18:12:06 Re: Race between prepared transaction commit and checkpointer
Previous Message Andrew Dunstan 2026-09-10 17:50:39 Re: Allow table AMs to define their own reloptions