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

Nathan Bossart <bossartn@amazon.com>

From: "Bossart, Nathan" <bossartn@amazon.com>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Bruce Momjian <bruce@momjian.us>, "Onder Kalaci" <onderk@microsoft.com>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2021-10-19T00:19:24Z
Lists: pgsql-hackers
On 10/18/21, 4:56 PM, "Alvaro Herrera" <alvherre@alvh.no-ip.org> wrote:
> Now, what is the worst that can happen if we rename a table under SUE
> and somebody else is using the table concurrently?  Is there any way to
> cause a backend crash or something like that?  As far as I can see,
> because we grab a fresh catalog snapshot for each query, you can't cause
> anything worse than reading from a different table.  I do lack
> imagination for creating attacks, though.

This message [0] in the thread for lowering the lock level for
renaming indexes seems to indicate that there may be some risk of
crashing.

Nathan

[0] https://postgr.es/m/CA%2BTgmobtmFT5g-0dA%3DvEFFtogjRAuDHcYPw%2BqEdou5dZPnF%3Dpg%40mail.gmail.com

Commits

  1. Ensure correct lock level is used in ALTER ... RENAME