Re: BUG #17220: ALTER INDEX ALTER COLUMN SET (..) with an optionless opclass makes index and table unusable - Mailing list pgsql-hackers

From Bossart, Nathan
Subject Re: BUG #17220: ALTER INDEX ALTER COLUMN SET (..) with an optionless opclass makes index and table unusable
Date
Msg-id 678CF71A-934B-4FD0-BF63-E41D795E41C9@amazon.com
Whole thread Raw
In response to Re: BUG #17220: ALTER INDEX ALTER COLUMN SET (..) with an optionless opclass makes index and table unusable  (Dilip Kumar <dilipbalaut@gmail.com>)
Responses Re: BUG #17220: ALTER INDEX ALTER COLUMN SET (..) with an optionless opclass makes index and table unusable  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
On 10/13/21, 1:31 AM, "Dilip Kumar" <dilipbalaut@gmail.com> wrote:
> On Wed, Oct 13, 2021 at 9:12 AM Michael Paquier <michael@paquier.xyz> wrote:
>> Anyway, specifying a column name for an ALTER INDEX is not right, no?
>> Just take for example the case of an expression which has a hardcoded
>> column name in pg_attribute.  So these are not specific to indexes,
>> which is why we apply column numbers for the statistics case.  I think
>> that we'd better just reject those cases until there is a proper
>> design done here.  As far as I can see, I guess that we should do
>> things  similarly to what we do for SET STATISTICS with column
>> numbers when it comes to indexes.
>
> +1 it should behave similarly to SET STATISTICS for the index and if
> someone tries to set with the column name then it should throw an
> error.

Good point.  I agree that rejecting this case is probably the best
option for now.  In addition to the bug mentioned in this thread, this
functionality doesn't even work for supported options currently.

        postgres=> create table test (a tsvector);
        CREATE TABLE
        postgres=> create index on test using gist (a);
        CREATE INDEX
        postgres=> alter index test_a_idx alter column a set (siglen = 100);
        ERROR:  unrecognized parameter "siglen"

AFAICT the fact that these commands can succeed at all seems to be
unintentional, and I wonder if modifying these options requires extra
steps such as rebuilding the index.

I've attached new patch that just adds an ERROR.

Nathan


Attachment

pgsql-hackers by date:

Previous
From: John Naylor
Date:
Subject: Re: [RFC] building postgres with meson
Next
From: Andres Freund
Date:
Subject: Re: [RFC] building postgres with meson