diff options
Diffstat (limited to 'src/backend/commands/schemacmds.c')
-rw-r--r-- | src/backend/commands/schemacmds.c | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/src/backend/commands/schemacmds.c b/src/backend/commands/schemacmds.c index b30fdce73d0..f678cda9024 100644 --- a/src/backend/commands/schemacmds.c +++ b/src/backend/commands/schemacmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/schemacmds.c,v 1.57 2010/02/26 02:00:39 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/schemacmds.c,v 1.58 2010/08/05 14:45:01 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -57,7 +57,7 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString) * Who is supposed to own the new schema? */ if (authId) - owner_uid = get_roleid_checked(authId); + owner_uid = get_role_oid(authId, false); else owner_uid = saved_uid; @@ -178,24 +178,13 @@ RemoveSchemas(DropStmt *drop) errmsg("schema name cannot be qualified"))); namespaceName = strVal(linitial(names)); - namespaceId = GetSysCacheOid1(NAMESPACENAME, - CStringGetDatum(namespaceName)); + namespaceId = get_namespace_oid(namespaceName, drop->missing_ok); if (!OidIsValid(namespaceId)) { - if (!drop->missing_ok) - { - ereport(ERROR, - (errcode(ERRCODE_UNDEFINED_SCHEMA), - errmsg("schema \"%s\" does not exist", - namespaceName))); - } - else - { - ereport(NOTICE, - (errmsg("schema \"%s\" does not exist, skipping", - namespaceName))); - } + ereport(NOTICE, + (errmsg("schema \"%s\" does not exist, skipping", + namespaceName))); continue; } @@ -264,9 +253,7 @@ RenameSchema(const char *oldname, const char *newname) errmsg("schema \"%s\" does not exist", oldname))); /* make sure the new name doesn't exist */ - if (HeapTupleIsValid( - SearchSysCache1(NAMESPACENAME, - CStringGetDatum(newname)))) + if (OidIsValid(get_namespace_oid(newname, true))) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_SCHEMA), errmsg("schema \"%s\" already exists", newname))); |