# pg_get_constraintdef

> 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_constraintdef
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-constraintdef
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-constraintdef.adoc
page-edit-url: https://github.com/redpanda-data/cloud-docs/edit/main/modules/reference/pages/sql/sql-functions/other-functions/pg-get-constraintdef.adoc
description: The pg_get_constraintdef() function retrieves the definition of a specific constraint in a human-readable format.
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-constraintdef.md -->

The [`pg_get_constraintdef()`](https://www.postgresql.org/docs/current/functions-info.html#FUNCTIONS-INFO-CATALOG) is a system catalog information function that retrieves the definition of a specific constraint in a human-readable format.

## [](#syntax)Syntax

```text
pg_get_constraintdef (constraint_oid [, pretty_bool]) → NULL
```

## [](#parameters)Parameters

-   [`constraint_oid`](https://www.postgresql.org/docs/current/catalog-pg-constraint.html): Specifies the object identifier (OID) of the constraint to retrieve the definition for.

-   [`pretty_bool`](https://www.postgresql.org/docs/current/datatype-boolean.html): Controls whether to format the output in a human-readable way.


## [](#restrictions)Restrictions

-   This implementation returns `NULL` when the `constraint_oid` parameter is `NULL`.