diff options
author | Neil Conway <neilc@samurai.com> | 2005-06-21 00:58:15 +0000 |
---|---|---|
committer | Neil Conway <neilc@samurai.com> | 2005-06-21 00:58:15 +0000 |
commit | 09d1110c2a17d9cf5c429797070634ad14e3684f (patch) | |
tree | 73a507abf6a04df2ea0bc50e31f3df116df87384 | |
parent | 2d4b9736bb9a5cd7228004f4ce2f21926f9087ee (diff) | |
download | postgresql-09d1110c2a17d9cf5c429797070634ad14e3684f.tar.gz postgresql-09d1110c2a17d9cf5c429797070634ad14e3684f.zip |
Trivial dead code removal: in CreateSchemaCommand(), 'owner_name' is
only used in one branch of an if statement, so we can move its
declaration to that block. This also avoids an unnecessary syscache
lookup.
Per Coverity static analysis performed by EnterpriseDB.
-rw-r--r-- | src/backend/commands/schemacmds.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/backend/commands/schemacmds.c b/src/backend/commands/schemacmds.c index 678169b18a5..5754c1dfcb4 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.29 2005/04/14 20:03:24 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/schemacmds.c,v 1.30 2005/06/21 00:58:15 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -42,7 +42,6 @@ CreateSchemaCommand(CreateSchemaStmt *stmt) Oid namespaceId; List *parsetree_list; ListCell *parsetree_item; - const char *owner_name; AclId owner_userid; AclId saved_userid; AclResult aclresult; @@ -56,13 +55,11 @@ CreateSchemaCommand(CreateSchemaStmt *stmt) if (!authId) { owner_userid = saved_userid; - owner_name = GetUserNameFromId(owner_userid); } else if (superuser()) { - owner_name = authId; /* The following will error out if user does not exist */ - owner_userid = get_usesysid(owner_name); + owner_userid = get_usesysid(authId); /* * Set the current user to the requested authorization so that @@ -74,6 +71,8 @@ CreateSchemaCommand(CreateSchemaStmt *stmt) } else { + const char *owner_name; + /* not superuser */ owner_userid = saved_userid; owner_name = GetUserNameFromId(owner_userid); |