1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-07 00:36:50 +03:00

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
This commit is contained in:
Robert Haas
2012-12-29 07:55:37 -05:00
parent 5ab3af46dd
commit 82b1b213ca
29 changed files with 231 additions and 131 deletions

View File

@ -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;
}