pg_attrdef

The pg_attrdef catalog provides information about column default expressions and generation expressions.

Column name Data type Description
oid oid A row identifier.
adrelid oid (references pg_class.oid) The table to which this column belongs.
adnum int2 (references pg_attribute.attnum) The number of the column.
adbin pg_node_tree The column default or generated expression in the nodeToString() representation.
Note: Use pg_get_expr(adbin, adrelid) to convert it into a standard SQL expression.