SELECT tbl.tablename AS 表名, a.attnum AS 字段顺序, a.attname AS 字段名, pg_type.typname AS 字段类型, col_description(a.attrelid, a.attnum) AS 注释, case a.attnotnull when 'f' then '否' when 't' then '是' end AS 是否必填
FROM pg_tables tbl, pg_class c, pg_attribute a, pg_type
WHERE tbl.schemaname = 'wirelessresource'
AND pg_type.oid = a.atttypid
AND tbl.tablename = c.relname
AND a.attrelid = c.oid
AND a.attnum > 0
ORDER BY tbl.tablename, a.attnum;
在navicat中可以直接导出结果为excel格式