agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
From: Antonin Houska <ah@cybertec.at>
To: Chao Li <li.evan.chao@gmail.com>
Cc: Alvaro Herrera <alvherre@kurilemu.de>
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: Fri, 11 Sep 2026 10:06:26 +0200
Message-ID: <10924.1789113986@localhost> (raw)
In-Reply-To: <D1A9CED4-4141-4EBA-A332-F4E683EA46ED@gmail.com>
References: <aqKC6K_QO0OEv3gy@alvherre.pgsql>
	<45513.1789063796@localhost>
	<D1A9CED4-4141-4EBA-A332-F4E683EA46ED@gmail.com>

Chao Li <li.evan.chao@gmail.com> wrote:

> On Sep 11, 2026, at 02:09, Antonin Houska <ah@cybertec.at> wrote:

> > Alvaro Herrera <alvherre@kurilemu.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






view thread (12+ messages)  latest in thread

Message-ID: <10924.1789113986@localhost>
Permalink:  ../10924.1789113986@localhost/
Also on:    postgresql.org/message-id/10924.1789113986@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, li.evan.chao@gmail.com, alvherre@kurilemu.de, boekewurm+postgres@gmail.com, nathandbossart@gmail.com
  Subject: Re: REPACK (CONCURRENTLY) fails when replica identity index is dropped
  In-Reply-To: <10924.1789113986@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