# pg_get_userbyid

> For the complete documentation index, see [llms.txt](https://docs.redpanda.com/llms.txt). Component-specific: [cloud-data-platform-full.txt](https://docs.redpanda.com/cloud-data-platform-full.txt)

---
title: pg_get_userbyid
latest-operator-version: v26.1.4
latest-console-tag: v3.7.3
latest-connect-version: 4.93.0
latest-redpanda-tag: v26.1.9
docname: sql/sql-functions/other-functions/pg-get-userbyid
page-component-name: cloud-data-platform
page-version: master
page-component-version: master
page-component-title: Cloud
page-relative-src-path: sql/sql-functions/other-functions/pg-get-userbyid.adoc
page-edit-url: https://github.com/redpanda-data/cloud-docs/edit/main/modules/reference/pages/sql/sql-functions/other-functions/pg-get-userbyid.adoc
description: The pg_get_userbyid() function retrieves the name of a user (role) given its unique identifier (OID).
page-topic-type: reference
page-git-created-date: "2026-05-26"
page-git-modified-date: "2026-05-26"
---

<!-- Source: https://docs.redpanda.com/cloud-data-platform/reference/sql/sql-functions/other-functions/pg-get-userbyid.md -->

The [`pg_get_userbyid()`](https://www.postgresql.org/docs/current/functions-info.html#FUNCTIONS-INFO-CATALOG) is a system catalog information function that retrieves the name of a user (role) given its unique identifier (OID).

## [](#syntax)Syntax

```sql
pg_get_userbyid(role_oid)
```

## [](#parameters)Parameters

-   `role_oid`: Specifies the object identifier (OID) of the user.


## [](#examples)Examples

Get the OIDs of all the users:

```sql
SELECT id,name FROM oxla_internal.oxla_role;
```

The query returns the list of users with their IDs (OIDs):

```sql
 id |  name
----+---------
  1 | oxla
  2 | other_user
(2 rows)
```

Translate the OID to a role name:

```sql
SELECT pg_get_userbyid(2);
```

The query returns:

```sql
 pg_get_userbyid
-----------------
 other_user
(1 row)
```