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

From: Antonin Houska <ah(at)cybertec(dot)at>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)kurilemu(dot)de>, 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-11 08:06:26
Message-ID: 10924.1789113986@localhost
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:

> On Sep 11, 2026, at 02:09, Antonin Houska <ah(at)cybertec(dot)at> wrote:

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

> +1
>
> Actually, there was a similar discussion in [1]. In that case, the question was whether setting a table to UNLOGGED should fail when the table is in a publication’s EXCEPT list, or whether PG should silently remove the table from the EXCEPT list and issue a notice to the user. Most people in that discussion, including Amit, seemed to prefer failing the operation. From a user-experience and design-consistency perspective, I think these two cases are quite similar.
>
> [1] https://postgr.es/m/CAA4eK1KHA-mkvtRPKsE-er8ePOnEu59_hxApaQKtr2=2GNOEQA@mail.gmail.com

I said "broken replication", but actually the missing replica identity index
triggers error even on the *primary*:

postgres=# delete from a where i=1;
ERROR: cannot delete from table "a" because it does not have a replica identity and publishes deletes
HINT: To enable deleting from the table, set REPLICA IDENTITY using ALTER
TABLE.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2026-09-11 08:06:30 Re: pg_createsubscriber does not check output_plugin_libraries
Previous Message Nisha Moond 2026-09-11 08:06:02 Re: Crashes on a partition whose concurrent detach never finished