Re: ALTER INDEX .. RENAME allows to rename tables/views as well - Mailing list pgsql-hackers

From Bossart, Nathan
Subject Re: ALTER INDEX .. RENAME allows to rename tables/views as well
Date
Msg-id 2F0D38B9-51CF-4794-BAF1-74921B735132@amazon.com
Whole thread Raw
In response to Re: ALTER INDEX .. RENAME allows to rename tables/views as well  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Responses Re: ALTER INDEX .. RENAME allows to rename tables/views as well  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Re: ALTER INDEX .. RENAME allows to rename tables/views as well  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-hackers
On 10/6/21, 4:45 PM, "Alvaro Herrera" <alvherre@alvh.no-ip.org> wrote:
> On 2021-Oct-06, Bossart, Nathan wrote:
>> I think we should at least consider adding this check for ALTER INDEX
>> since we choose a different lock level in that case.
>
> I agree -- letting ALTER INDEX process relations that aren't indexes is
> dangerous, with its current coding that uses a reduced lock level.  But
> maybe erroring out is not necessary; can we instead loop, locking the
> object with ShareUpdateExclusive first, assuming it *is* an index, and
> if it isn't then we release and restart using the stronger lock this
> time?

Good idea.  Patch attached.

Nathan


Attachment

pgsql-hackers by date:

Previous
From: Jaime Casanova
Date:
Subject: Re: [Patch] ALTER SYSTEM READ ONLY
Next
From: Fujii Masao
Date:
Subject: Re: [EXTERNAL] Re: PQcancel does not use tcp_user_timeout, connect_timeout and keepalive settings