Re: Proposal to Enable/Disable Index using ALTER INDEX (with patch)

Shayon Mukherjee <shayonj@gmail.com>

From: Shayon Mukherjee <shayonj@gmail.com>
To: David Rowley <dgrowleyml@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>, Peter Eisentraut <peter@eisentraut.org>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-10-16T18:15:51Z
Lists: pgsql-hackers
> On Oct 16, 2024, at 12:19 PM, Shayon Mukherjee <shayonj@gmail.com> wrote:
> 
> - ALTER INDEX ... ENABLE/DISABLE performs an in-place update of the pg_index 
>   catalog to protect against indcheckxmin [2] (older unrelated thread).

Performing the in place update of the pg_index row from ATExecEnableDisableIndex using systable_inplace_update_begin was failing in CI weirdly but not on my local MacBook when running spec suite. I am also wondering what is causing the requirement [1] to update the row in-place vs say using CatalogTupleUpdate since using the later is working well locally + CI? 

I have attached a v2 patch (following from the last v1 patch [1]) that uses CatalogTupleUpdate and local + CI [2] is passing. 

[1] https://www.postgresql.org/message-id/20180618215635.m5vrnxdxhxytvmcm@alap3.anarazel.de
[2] https://www.postgresql.org/message-id/EF2313B8-A017-4869-9B7F-A24EDD8795DE%40gmail.com
[3]  https://github.com/shayonj/postgres/pull/1

Thanks
Shayon