获取postgresql表字段,类型,注释
SELECT
a.attname AS columnName,
concat_ws('',t.typname,SUBSTRING(format_type(a.atttypid,a.atttypmod) from '\(.*\)')) as columnType,
d.description AS comment
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