1. 获取字段名、类型、注释、是否为空
SELECT
col_description (a.attrelid, a.attnum) as comment,
format_type (a.atttypid, a.atttypmod) as type,
a.attname as name,
a.attnotnull as notnull
FROM
pg_class as c,
pg_attribute as a
where
c.relname = 'persons'
and a.attrelid = c.oid
and a.attnum > 0
order by
a.attname;
2. select * from pg_tables---查询数据库下的所有表名
标签:postgresql,--,attnum,attrelid,备注,type,pg From: https://www.cnblogs.com/renjie1105/p/16598092.html