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

From Michael Paquier
Subject Add support for ALTER INDEX .. ALTER [COLUMN] col_num {SET,RESET}
Date
Msg-id YXuCDicA8rq4iryZ@paquier.xyz
Whole thread Raw
Responses Re: Add support for ALTER INDEX .. ALTER [COLUMN] col_num {SET,RESET}
List pgsql-hackers
Hi all,

Since 911e702 (13~), it is possible to define opclass parameters for
index attributes as of CREATE INDEX, but we lack an equivalent grammar
for ALTER INDEX.  I was looking at that, and it seems natural to me to
do the same thing as what we do for SET STATISTICS, where we use a
column number to decide which column should be used to set or reset a
parameter.

It happens that most of the infrastructure is already in place to
allow that to work, I just had to push a bit the parser and
tablecmds.c to handle that, thanks to the fact that opclass parameters
are stored in pg_attribute in the same fashion as table parameters,
where we use a simple text array for each param/value pair.  The only
tweak is to go through the correct validation option, aka
index_opclass_options() (this was discussed on the thread that led to
fdd8857).  So this adds much more flexibility to the opclass handling
for indexes.

The attached does the work, with tests and documentation added to all
the places I could think about while reviewing the existing opclass
code for indexes.  There is no need to worry about pg_dump, as opclass
parameters are loaded with CREATE INDEX.

I am adding that to the upcoming CF.  Thoughts?

Thanks,
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Kevin Burke
Date:
Subject: Re: Support for NSS as a libpq TLS backend
Next
From: Masahiko Sawada
Date:
Subject: Re: Skipping logical replication transactions on subscriber side