Re: ALTER INDEX .. RENAME allows to rename tables/views as well

From: "Bossart, Nathan" <bossartn(at)amazon(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <bruce(at)momjian(dot)us>, "Onder Kalaci" <onderk(at)microsoft(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: ALTER INDEX .. RENAME allows to rename tables/views as well
Date: 2021-10-07 00:41:23
Message-ID: 2F0D38B9-51CF-4794-BAF1-74921B735132@amazon.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10/6/21, 4:45 PM, "Alvaro Herrera" <alvherre(at)alvh(dot)no-ip(dot)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 Content-Type Size
v2-0001-Ensure-correct-lock-level-is-used-for-rename-stat.patch application/octet-stream 4.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2021-10-07 00:46:47 Re: [EXTERNAL] Re: PQcancel does not use tcp_user_timeout, connect_timeout and keepalive settings
Previous Message Jaime Casanova 2021-10-07 00:26:51 Re: [Patch] ALTER SYSTEM READ ONLY