1、Navicat执行以下sql
SELECT
A.attnum AS "序号",
C.relname AS "表名",
CAST ( obj_description ( relfilenode, 'pg_class' ) AS VARCHAR ) AS "表名描述",
A.attname AS "字段名称",
A.attnotnull as "是否不为null",
(case when A.attnotnull = 't' then '是' else '否' end) as "是否必填",
concat_ws ( '', T.typname, SUBSTRING ( format_type ( A.atttypid, A.atttypmod ) FROM '\(.*\)' ) ) AS "数据类型",
T.typname as "字段属性",
SUBSTRING(SUBSTRING ( format_type ( A.atttypid, A.atttypmod ) FROM '\(.*\)' ) from '\(([^)]+)\)') as "长度",
d.description AS "备注"
FROM
pg_class C,
pg_attribute A,
pg_type T,
pg_description d
WHERE
C.relname = '替换成要查的表名'
AND A.attnum > 0
AND A.attrelid = C.oid
AND A.atttypid = T.oid
AND d.objoid = A.attrelid
AND d.objsubid = A.attnum
ORDER BY
C.relname DESC,
A.attnum ASC
2、导出查询结果
3、导出的excel如下