pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Ensure correct lock level is used in ALTER ... RENAME
Date: Tue, 19 Oct 2021 22:11:24 +0000
Message-ID: <E1mcxKO-0004JX-40@gemulon.postgresql.org> (raw)

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

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/3ce3fb2f7dc66fef67c8184b96245d74372b729e

Modified Files
--------------
src/backend/commands/tablecmds.c          | 62 ++++++++++++++++++++++++-------
src/test/regress/expected/alter_table.out | 48 ++++++++++++++++++++++++
src/test/regress/sql/alter_table.sql      | 31 ++++++++++++++++
3 files changed, 127 insertions(+), 14 deletions(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1mcxKO-0004JX-40@gemulon.postgresql.org>
Permalink:  ../E1mcxKO-0004JX-40@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1mcxKO-0004JX-40@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: alvherre@alvh.no-ip.org
  Subject: Re: pgsql: Ensure correct lock level is used in ALTER ... RENAME
  In-Reply-To: <E1mcxKO-0004JX-40@gemulon.postgresql.org>
  References: <E1mcxKO-0004JX-40@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox