Re: BUG #17220: ALTER INDEX ALTER COLUMN SET (..) with an optionless opclass makes index and table unusable
Nathan Bossart <bossartn@amazon.com>
From: "Bossart, Nathan" <bossartn@amazon.com>
To: Dilip Kumar <dilipbalaut@gmail.com>, Michael Paquier <michael@paquier.xyz>
Cc: Vik Fearing <vik@postgresfriends.org>, "postgresql@zr40.nl" <postgresql@zr40.nl>, Alexander Korotkov <aekorotkov@gmail.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2021-10-13T17:20:56Z
Lists: pgsql-bugs, pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Block ALTER INDEX/TABLE index_name ALTER COLUMN colname SET (options)
- 85dc4292a7a1 13.5 landed
- b1b797ec71a1 14.1 landed
- fdd88571454e 15.0 landed
Attachments
- disallow_alter_index_column_set.patch (application/octet-stream) patch
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