Other
pg_get_userbyid()
Overview
The pg_get_userbyid() is a system catalog information function that retrieves that name of a user (role) given its unique identifier (OID).
Syntax
The syntax for the pg_get_userbyid()
function is as follows:
Parameters
The following parameters are required to execute this function:
role_oid
: specifies the object identifier (OIDs) of the users
Example
In this example, what we will do first is to get the OIDs of all the users
Then, return the list of users with their ids (OIDs):
As the next step we will translate the OID to a role name in a following way:
By executing the code above, we will get the following result: