diff options
author | Robert Haas <rhaas@postgresql.org> | 2012-12-29 07:55:37 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2012-12-29 07:55:37 -0500 |
commit | 82b1b213cad3a69cf5f3dfaa81687c14366960fc (patch) | |
tree | e19129f124c02d7ef274393d584de97cc18a5f66 /src/backend/commands/user.c | |
parent | 5ab3af46ddd2f2c2b248f1ffdb688b394d4bb387 (diff) | |
download | postgresql-82b1b213cad3a69cf5f3dfaa81687c14366960fc.tar.gz postgresql-82b1b213cad3a69cf5f3dfaa81687c14366960fc.zip |
Adjust more backend functions to return OID rather than void.
This is again intended to support extensions to the event trigger
functionality. This may go a bit further than we need for that
purpose, but there's some value in being consistent, and the OID
may be useful for other purposes also.
Dimitri Fontaine
Diffstat (limited to 'src/backend/commands/user.c')
-rw-r--r-- | src/backend/commands/user.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c index 569385cf234..6cf40cc0811 100644 --- a/src/backend/commands/user.c +++ b/src/backend/commands/user.c @@ -67,7 +67,7 @@ have_createrole_privilege(void) /* * CREATE ROLE */ -void +Oid CreateRole(CreateRoleStmt *stmt) { Relation pg_authid_rel; @@ -433,6 +433,8 @@ CreateRole(CreateRoleStmt *stmt) * Close pg_authid, but keep lock till commit. */ heap_close(pg_authid_rel, NoLock); + + return roleid; } @@ -443,7 +445,7 @@ CreateRole(CreateRoleStmt *stmt) * backwards-compatible ALTER GROUP syntax. Although it will work to say * "ALTER ROLE role ROLE rolenames", we don't document it. */ -void +Oid AlterRole(AlterRoleStmt *stmt) { Datum new_record[Natts_pg_authid]; @@ -799,17 +801,20 @@ AlterRole(AlterRoleStmt *stmt) * Close pg_authid, but keep lock till commit. */ heap_close(pg_authid_rel, NoLock); + + return roleid; } /* * ALTER ROLE ... SET */ -void +Oid AlterRoleSet(AlterRoleSetStmt *stmt) { HeapTuple roletuple; Oid databaseid = InvalidOid; + Oid roleid; roletuple = SearchSysCache1(AUTHNAME, PointerGetDatum(stmt->role)); @@ -818,6 +823,8 @@ AlterRoleSet(AlterRoleSetStmt *stmt) (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("role \"%s\" does not exist", stmt->role))); + roleid = HeapTupleGetOid(roletuple); + /* * Obtain a lock on the role and make sure it didn't go away in the * meantime. @@ -853,6 +860,8 @@ AlterRoleSet(AlterRoleSetStmt *stmt) AlterSetting(databaseid, HeapTupleGetOid(roletuple), stmt->setstmt); ReleaseSysCache(roletuple); + + return roleid; } |