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

From: Alvaro Herrera <alvherre(at)kurilemu(dot)de>
To: Antonin Houska <ah(at)cybertec(dot)at>
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 10:22:52
Message-ID: aqKC6K_QO0OEv3gy@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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?

--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"After a quick R of TFM, all I can say is HOLY CR** THAT IS COOL! PostgreSQL was
amazing when I first started using it at 7.2, and I'm continually astounded by
learning new features and techniques made available by the continuing work of
the development team."
Berend Tober, http://archives.postgresql.org/pgsql-hackers/2007-08/msg01009.php

Attachment Content-Type Size
0001-Revert-replica-identity-to-default-if-the-index-is-d.patch text/x-diff 3.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Osama Abdul Qader 2026-09-10 10:24:20 Re: Several issues with postgres_fdw stats import
Previous Message Osama Abdul Qader 2026-09-10 10:14:25 Re: REPACK (ANALYZE) within transaction block segfaults