Add support for ALTER INDEX .. ALTER [COLUMN] col_num {SET,RESET}

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Add support for ALTER INDEX .. ALTER [COLUMN] col_num {SET,RESET}
Date: 2021-10-29 05:09:34
Message-ID: YXuCDicA8rq4iryZ@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
v1-0001-Add-support-for-ALTER-INDEX-ALTER-COLUMN-SET-RESE.patch text/x-diff 15.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2021-10-29 05:24:11 Re: Skipping logical replication transactions on subscriber side
Previous Message Kevin Burke 2021-10-29 04:36:43 Re: Support for NSS as a libpq TLS backend