diff options
author | Robert Haas <rhaas@postgresql.org> | 2011-12-15 18:51:46 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2011-12-15 19:02:38 -0500 |
commit | 74a1d4fe7cc092076806767925d6f34ea347efde (patch) | |
tree | 4aec82c1cc22d267358d7216e7ec78650ee05f9f /src/include | |
parent | d039fd51f79e9ddde4d692d2b396bdf5722b4c4e (diff) | |
download | postgresql-74a1d4fe7cc092076806767925d6f34ea347efde.tar.gz postgresql-74a1d4fe7cc092076806767925d6f34ea347efde.zip |
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.
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/commands/tablecmds.h | 9 | ||||
-rw-r--r-- | src/include/commands/trigger.h | 2 |
2 files changed, 4 insertions, 7 deletions
diff --git a/src/include/commands/tablecmds.h b/src/include/commands/tablecmds.h index 333e30326d5..20632eb87b9 100644 --- a/src/include/commands/tablecmds.h +++ b/src/include/commands/tablecmds.h @@ -45,15 +45,12 @@ extern void ExecuteTruncate(TruncateStmt *stmt); extern void SetRelationHasSubclass(Oid relationId, bool relhassubclass); -extern void renameatt(Oid myrelid, RenameStmt *stmt); +extern void renameatt(RenameStmt *stmt); -extern void RenameRelation(Oid myrelid, - const char *newrelname, - ObjectType reltype); +extern void RenameRelation(RenameStmt *stmt); extern void RenameRelationInternal(Oid myrelid, - const char *newrelname, - Oid namespaceId); + const char *newrelname); extern void find_composite_type_dependencies(Oid typeOid, Relation origRelation, diff --git a/src/include/commands/trigger.h b/src/include/commands/trigger.h index e7d28f7cdd2..4e3fb7db803 100644 --- a/src/include/commands/trigger.h +++ b/src/include/commands/trigger.h @@ -115,7 +115,7 @@ extern Oid CreateTrigger(CreateTrigStmt *stmt, const char *queryString, extern void RemoveTriggerById(Oid trigOid); extern Oid get_trigger_oid(Oid relid, const char *name, bool missing_ok); -extern void renametrig(Oid relid, const char *oldname, const char *newname); +extern void renametrig(RenameStmt *stmt); extern void EnableDisableTrigger(Relation rel, const char *tgname, char fires_when, bool skip_system); |