pg_attrdef
目录pg_attrdef存储列默认表达式和生成表达式。列的主要信息存储在pg_attribute中。只有显式设置了默认表达式或生成表达式的列,才会在此目录中有条目。
pg_attribute
Table 51.6. pg_attrdef 列
列类型
描述
oid oid
oid
行标识符
adrelid oid (引用 pg_class.oid)
adrelid
pg_class
该列所属的表
adnum int2 (引用 pg_attribute.attnum)
adnum
int2
attnum
列的编号
adbin pg_node_tree
adbin
pg_node_tree
列默认表达式或生成表达式的内部表示,采用 nodeToString() 的输出格式。 可使用 pg_get_expr(adbin, adrelid) 将其转换为 SQL 表达式。
nodeToString()
pg_get_expr(adbin, adrelid)