diff options
Diffstat (limited to 'src/backend/commands/rename.c')
-rw-r--r-- | src/backend/commands/rename.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/backend/commands/rename.c b/src/backend/commands/rename.c index 308808c2202..0ce475303a7 100644 --- a/src/backend/commands/rename.c +++ b/src/backend/commands/rename.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.63 2001/11/12 01:34:50 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.64 2002/03/21 23:27:21 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -82,6 +82,13 @@ renameatt(char *relname, List *indexoidscan; /* + * Grab an exclusive lock on the target table, which we will NOT + * release until end of transaction. + */ + targetrelation = heap_openr(relname, AccessExclusiveLock); + relid = RelationGetRelid(targetrelation); + + /* * permissions checking. this would normally be done in utility.c, * but this particular routine is recursive. * @@ -90,19 +97,11 @@ renameatt(char *relname, if (!allowSystemTableMods && IsSystemRelationName(relname)) elog(ERROR, "renameatt: class \"%s\" is a system catalog", relname); - if (!IsBootstrapProcessingMode() && - !pg_ownercheck(GetUserId(), relname, RELNAME)) + if (!pg_class_ownercheck(relid, GetUserId())) elog(ERROR, "renameatt: you do not own class \"%s\"", relname); /* - * Grab an exclusive lock on the target table, which we will NOT - * release until end of transaction. - */ - targetrelation = heap_openr(relname, AccessExclusiveLock); - relid = RelationGetRelid(targetrelation); - - /* * if the 'recurse' flag is set then we are supposed to rename this * attribute in all classes that inherit from 'relname' (as well as in * 'relname'). |