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/creatinh.c | |
parent | 6137ed1b591920d919e437fbf6e2ea07de44a883 (diff) |
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/creatinh.c')
-rw-r--r-- | src/backend/commands/creatinh.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/backend/commands/creatinh.c b/src/backend/commands/creatinh.c index 04854a2afa1..91f5d14a37a 100644 --- a/src/backend/commands/creatinh.c +++ b/src/backend/commands/creatinh.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.89 2002/03/21 16:00:31 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.90 2002/03/21 23:27:20 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -247,13 +247,6 @@ TruncateRelation(const char *relname) AssertArg(relname); - if (!allowSystemTableMods && IsSystemRelationName(relname)) - elog(ERROR, "TRUNCATE cannot be used on system tables. '%s' is a system table", - relname); - - if (!pg_ownercheck(GetUserId(), relname, RELNAME)) - elog(ERROR, "you do not own relation \"%s\"", relname); - /* Grab exclusive lock in preparation for truncate */ rel = heap_openr(relname, AccessExclusiveLock); @@ -265,6 +258,13 @@ TruncateRelation(const char *relname) elog(ERROR, "TRUNCATE cannot be used on views. '%s' is a view", relname); + if (!allowSystemTableMods && IsSystemRelationName(relname)) + elog(ERROR, "TRUNCATE cannot be used on system tables. '%s' is a system table", + relname); + + if (!pg_class_ownercheck(RelationGetRelid(rel), GetUserId())) + elog(ERROR, "you do not own relation \"%s\"", relname); + /* Keep the lock until transaction commit */ heap_close(rel, NoLock); @@ -458,7 +458,7 @@ MergeAttributes(List *schema, List *supers, bool istemp, * We should have an UNDER permission flag for this, but for now, * demand that creator of a child table own the parent. */ - if (!pg_ownercheck(GetUserId(), name, RELNAME)) + if (!pg_class_ownercheck(RelationGetRelid(relation), GetUserId())) elog(ERROR, "you do not own table \"%s\"", name); parentOids = lappendi(parentOids, relation->rd_id); |