diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-03-21 23:27:25 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-03-21 23:27:25 +0000 |
commit | 56c9b73c1d426c79a604df6d6f36293dd9f18754 (patch) | |
tree | e381610845e8693ec025af08f4ddc405247461d9 /src/backend/commands/rename.c | |
parent | 6137ed1b591920d919e437fbf6e2ea07de44a883 (diff) | |
download | postgresql-56c9b73c1d426c79a604df6d6f36293dd9f18754.tar.gz postgresql-56c9b73c1d426c79a604df6d6f36293dd9f18754.zip |
Change the aclchk.c routines to uniformly use OIDs to identify the
objects to be privilege-checked. Some change in their APIs would be
necessary no matter what in the schema environment, and simply getting
rid of the name-based interface entirely seems like the best way.
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'). |