数据字典表头数据字典查询sqlselect b.表名,b.表描述,b.列名,b.类型,b.长度,b.主键约束,b.唯一约束,b.外键约束,b.可否为空,(case when c.column_name is not null then 'Y' else 'N' end) as 索引字段,b.描述
from
(select
(select relname from pg_class where oid=a.attrelid) as 表名,
(select relname ||'–'||(select description from pg_description where objoid = oid and objsubid = 0) from pg_class where oid=a.attrelid) as 表描述,
a.attname as 列名,
format_type(a.atttypid,a.atttypmod) as 类型,
(case when atttypmod-4>0 then atttypmod-4 else 0 end) as 长度,
(case when
Xinbo