]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Ensure correct lock level is used in ALTER ... RENAME
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Tue, 19 Oct 2021 22:08:45 +0000 (19:08 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Tue, 19 Oct 2021 22:08:45 +0000 (19:08 -0300)
commit3ce3fb2f7dc66fef67c8184b96245d74372b729e
tree5ef30c10f560e660f0becd7c08afa6a2db9d3f78
parent533315b68f8a00784686500f29ee780244341bc2
Ensure correct lock level is used in ALTER ... RENAME

Commit 1b5d797cd4f7 intended to relax the lock level used to rename
indexes, but inadvertently allowed *any* relation to be renamed with a
lowered lock level, as long as the command is spelled ALTER INDEX.
That's undesirable for other relation types, so retry the operation with
the higher lock if the relation turns out not to be an index.

After this fix, ALTER INDEX <sometable> RENAME will require access
exclusive lock, which it didn't before.

Author: Nathan Bossart <bossartn@amazon.com>
Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
Reported-by: Onder Kalaci <onderk@microsoft.com>
Discussion: https://postgr.es/m/PH0PR21MB1328189E2821CDEC646F8178D8AE9@PH0PR21MB1328.namprd21.prod.outlook.com
src/backend/commands/tablecmds.c
src/test/regress/expected/alter_table.out
src/test/regress/sql/alter_table.sql