pgsql: Improve behavior of concurrent rename statements.

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Improve behavior of concurrent rename statements.
Date: 2011-12-16 00:03:26
Message-ID: E1RbLGo-0006Dv-LV@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Improve behavior of concurrent rename statements.

Previously, renaming a table, sequence, view, index, foreign table,
column, or trigger checked permissions before locking the object, which
meant that if permissions were revoked during the lock wait, we would
still allow the operation. Similarly, if the original object is dropped
and a new one with the same name is created, the operation will be allowed
if we had permissions on the old object; the permissions on the new
object don't matter. All this is now fixed.

Along the way, attempting to rename a trigger on a foreign table now gives
the same error message as trying to create one there in the first place
(i.e. that it's not a table or view) rather than simply stating that no
trigger by that name exists.

Patch by me; review by Noah Misch.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/74a1d4fe7cc092076806767925d6f34ea347efde

Modified Files
--------------
src/backend/commands/alter.c | 62 ++-----------
src/backend/commands/cluster.c | 8 +--
src/backend/commands/tablecmds.c | 186 +++++++++++++++++++++++++-------------
src/backend/commands/trigger.c | 63 +++++++++++---
src/backend/commands/typecmds.c | 3 +-
src/include/commands/tablecmds.h | 9 +--
src/include/commands/trigger.h | 2 +-
7 files changed, 192 insertions(+), 141 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andrew Dunstan 2011-12-16 01:12:15 pgsql: include_if_exists facility for config file.
Previous Message Robert Haas 2011-12-15 23:45:45 pgsql: Don't leave regress_test_role_super lying around.