SQL Reference
...
SQL Functions
Other Functions
pg_get_expr
6min
The pg_get_expr function retrieves the internal form of an individual expression, such as the default value for a column.
There are two versions of the pg_get_expr function:
Version 1

Version 2

Please see the breakdown of both versions:
- expr_text: The expression for which you want to obtain the internal representation. It can be any string value.
- relation_oid: The OID (Object Identifier) of the table the expression belongs to. It is in integer type.
- pretty_bool: A boolean value determining whether to format the expression in a more human-readable format (TRUE) or not (FALSE).
Both versions of the pg_get_expr function return an empty string "".
1. First, create a sample table named employees.

2. Get OID of the table.

You will get the OID of the table:

3. Retrieve the internal form for the salary column using pg_get_expr.

Both return the same value, an empty string "".


Updated 31 Oct 2023

Did this page help you?