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-07T00:41:23Z
Lists: pgsql-hackers
Attachments
- v2-0001-Ensure-correct-lock-level-is-used-for-rename-stat.patch (application/octet-stream) patch v2-0001
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
Commits
-
Ensure correct lock level is used in ALTER ... RENAME
- c2c618ff1137 15.0 landed
- 842fe6123c8a 13.5 landed
- 6c8d1c197bd6 12.9 landed
- 3ce3fb2f7dc6 14.1 landed