Postgresql 查询表结构脚本原创
3人赞赏了该文章
281次浏览
编辑于2021年10月14日 11:22:45
SELECT a.attnum,a.attname AS field,t.typname AS type,a.attlen AS length,a.atttypmod AS lengthvar,a.attnotnull AS notnull,b.description AS comment
FROM pg_class c,pg_attribute a
LEFT OUTER JOIN pg_description b ON a.attrelid=b.objoid AND a.attnum = b.objsubid,
pg_type t
WHERE c.relname = lower('T_FW_UserCustomConfig') --修改为要查询的表名
and a.attnum > 0 and a.attrelid = c.oid
and a.atttypid = t.oid ORDER BY a.attnum;
推荐阅读