详细SQL语句:
C.relname = ‘你的表名’ 直接输入表面即可
SELECT
C.relname AS "表名",
CAST(obj_description(C.oid, 'pg_class') AS VARCHAR) AS "表名描述",
A.attname AS "字段名",
CASE
WHEN A.attnotnull = 'f' THEN '否'
ELSE '是'
END AS "是否为空",
concat_ws ( '', T.typname, SUBSTRING ( format_type ( A.atttypid, A.atttypmod ) FROM '\(.*\)' ) ) AS "数据类型",
d.description AS "注释"
FROM
pg_class C,
pg_attribute A,
pg_type T,
pg_description d
WHERE
C.relname = '你的表名'
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;