返回默认值
来自 PostgreSQL Wiki
跳转到导航跳转到搜索作者: Emanuel
该函数返回一个列的默认值
CREATE FUNCTION ret_def(text,text,text) RETURNS text AS $$
SELECT
columns.column_default::text
FROM
information_schema.columns
where table_name = $2
and table_schema = $1
and column_name = $3
$$ LANGUAGE sql IMUTABLE;
以这种方式调用它即可
SELECT ret_def('schema','table','column');