aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/user.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/commands/user.c')
-rw-r--r--src/backend/commands/user.c15
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;
}