# pg_get_expr

> 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_expr
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-expr
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-expr.adoc
page-edit-url: https://github.com/redpanda-data/cloud-docs/edit/main/modules/reference/pages/sql/sql-functions/other-functions/pg-get-expr.adoc
description: The pg_get_expr() function retrieves the internal form of an individual expression, such as the default value for a column.
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-expr.md -->

The [`pg_get_expr()`](https://www.postgresql.org/docs/current/functions-info.html#FUNCTIONS-INFO-CATALOG) is a system catalog information function that retrieves the internal form of an individual expression, such as the default value for a column.

## [](#syntax)Syntax

The `pg_get_expr()` function has two available syntax versions:

```sql
SELECT pg_get_expr('expr_text', relation_oid);
```

```sql
SELECT pg_get_expr('expr_text', relation_oid, pretty_bool);
```

Both versions of the `pg_get_expr()` function return an empty string `""`.

## [](#parameters)Parameters

-   `expr_text`: Expression to obtain the internal representation for (can be any string value).

-   `relation_oid`: OID (object identifier) of the table the expression belongs to (integer type).

-   `pretty_bool`: Boolean value determining whether to format the expression in a more human-readable format (`TRUE`) or not (`FALSE`).


## [](#examples)Examples

First, create a sample table named **employees**:

```sql
CREATE TABLE employees (
    id INT,
    name TEXT,
    salary TEXT
);
```

Then get the OID of the table:

```sql
SELECT oid FROM pg_class WHERE relname = 'employees';
```

```sql
 oid
------
 1018
```

Retrieve the internal form for the `salary` column using the `pg_get_expr()` function:

```sql
-- Version 1
SELECT pg_get_expr('salary', 1018);

-- Version 2
SELECT pg_get_expr('salary', 1018, TRUE);
```

Either query returns:

```sql
 pg_get_expr
-------------
```