Other
pg_get_expr()
Overview
The pg_get_expr() is a system catalog information function that retrieves the internal form of an individual expression, such as the default value for a column.
Syntax
There are two available syntax versions of the pg_get_expr()
function:
Both versions of the pg_get_expr()
function return an empty string ""
.
Parameters
The following parameters are required to execute this function:
expr_text
: expression for which you want to obtain the internal representation (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
)
Example
For the needs of this section, first we will create a sample table named employees
Then we will get the OID of the table
As the last step, we will retrieve the internal form for the salary
column using pg_get_expr()
function
By executing any of the queries above, we will get the following output: