> ## Documentation Index
> Fetch the complete documentation index at: https://docs.oxla.com/llms.txt
> Use this file to discover all available pages before exploring further.

# pg_get_userbyid()

## Overview

The <a href="https://www.postgresql.org/docs/current/functions-info.html#FUNCTIONS-INFO-CATALOG" target="_blank">pg\_get\_userbyid()</a> 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:

```sql theme={null}
pg_get_userbyid(role_oid)
```

## 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

```sql theme={null}
SELECT id,name FROM oxla_internal.oxla_role;
```

Then, return the list of users with their ids (OIDs):

```sql theme={null}
 id |  name
----+---------
  1 | oxla
  2 | other_user
(2 rows)
```

As the next step we will translate the OID to a role name in a following way:

```sql theme={null}
SELECT pg_get_userbyid(2);
```

By executing the code above, we will get the following result:

```sql theme={null}
 pg_get_userbyid
-----------------
 other_user
(1 row)
```
