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

From: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: "Bossart, Nathan" <bossartn(at)amazon(dot)com>, Vik Fearing <vik(at)postgresfriends(dot)org>, "postgresql(at)zr40(dot)nl" <postgresql(at)zr40(dot)nl>, Alexander Korotkov <aekorotkov(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: BUG #17220: ALTER INDEX ALTER COLUMN SET (..) with an optionless opclass makes index and table unusable
Date: 2021-10-13 08:29:51
Message-ID: CAFiTN-t9JSHmCtOtB_28BmAXEantUC2=1OKV_irAPAoxnzPadA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Wed, Oct 13, 2021 at 9:12 AM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Wed, Oct 13, 2021 at 12:06:32AM +0000, Bossart, Nathan wrote:
> > At first glance, it looks like ALTER INDEX .. ALTER COLUMN ... SET
> > uses the wrong validation function. I've attached a patch where I've
> > attempted to fix that and added some tests.
>
> The gap is larger than than, because ALTER INDEX .. ALTER COLUMN
> .. SET is supported by the parser but we don't document it. The only
> thing we document now is SET STATISTICS that applies to a column
> *number*.
>
> 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.

--
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2021-10-13 09:16:08 BUG #17227: segmentation fault with jsonb_to_recordset
Previous Message Boris Korzun 2021-10-13 08:22:49 Re: Inconsistent behavior of pg_dump/pg_restore on DEFAULT PRIVILEGES

Browse pgsql-hackers by date

  From Date Subject
Next Message Sergey Shinderuk 2021-10-13 08:35:34 Re: Bug in DefineRange() with multiranges
Previous Message Boris Korzun 2021-10-13 08:22:49 Re: Inconsistent behavior of pg_dump/pg_restore on DEFAULT PRIVILEGES