Alvaro Herrera <[email protected]> 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


Reply via email to