Re: Add support for ALTER INDEX .. ALTER [COLUMN] col_num {SET,RESET} - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Add support for ALTER INDEX .. ALTER [COLUMN] col_num {SET,RESET}
Date
Msg-id YYCzlIBpoO6UtGCC@paquier.xyz
Whole thread Raw
In response to Re: Add support for ALTER INDEX .. ALTER [COLUMN] col_num {SET,RESET}  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
On Sat, Oct 30, 2021 at 09:45:50AM +0900, Michael Paquier wrote:
> Another thing that could be done is to mark the index as invalid once
> its set of opclass parameters is updated.  That would be simpler,
> while allowing users to fire a concurrent or non-concurrent rebuild at
> will after an ALTER INDEX.

For the note here, I have looked at this possibility.  And things
become very tricky when it comes to indexes marked as either
indisclustered or indisreplident.  REINDEX CONCURRENTLY has the
particularity to switch both parameters to false when swapping to the
new index because we don't need the new index anymore.  Invalid
indexes can create with CREATE INDEX CONCURRENTLY (constraint failure
at creation for example), but they won't have any of those flags set.
So we assume now that indisinvalid is linked to both of them.

This makes the problem mentioned upthread trickier than it looks, as
we'd need to decide what to do after an ALTER INDEX that just switches
an index to be invalid if any of these are set for the existing
index.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: removing global variable ThisTimeLineID
Next
From: Greg Nancarrow
Date:
Subject: Re: Skipping logical replication transactions on subscriber side