MCPcopy Create free account
hub / github.com/apache/cloudberry / GetUserNameFromId

Function GetUserNameFromId

src/backend/utils/init/miscinit.c:953–974  ·  view source on GitHub ↗

* Get user name from user oid, returns NULL for nonexistent roleid if noerr * is true. */

Source from the content-addressed store, hash-verified

951 * is true.
952 */
953char *
954GetUserNameFromId(Oid roleid, bool noerr)
955{
956 HeapTuple tuple;
957 char *result;
958
959 tuple = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid));
960 if (!HeapTupleIsValid(tuple))
961 {
962 if (!noerr)
963 ereport(ERROR,
964 (errcode(ERRCODE_UNDEFINED_OBJECT),
965 errmsg("invalid role OID: %u", roleid)));
966 result = NULL;
967 }
968 else
969 {
970 result = pstrdup(NameStr(((Form_pg_authid) GETSTRUCT(tuple))->rolname));
971 ReleaseSysCache(tuple);
972 }
973 return result;
974}
975
976Oid
977GetCurrentWarehouseId(void)

Callers 15

insert_usernameFunction · 0.85
dblink_connstr_checkFunction · 0.85
current_userFunction · 0.85
session_userFunction · 0.85
regroleoutFunction · 0.85
check_is_member_of_roleFunction · 0.85
execute_extension_scriptFunction · 0.85
DefineTaskFunction · 0.85
AlterTaskFunction · 0.85
DropTaskFunction · 0.85
ScheduleCronJobFunction · 0.85

Calls 6

SearchSysCache1Function · 0.85
ObjectIdGetDatumFunction · 0.85
ReleaseSysCacheFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50
pstrdupFunction · 0.50

Tested by

no test coverage detected