查询所有业务表信息
select * from pg_tables where tablename not like 'pg%' and tablename not like 'sql_%' order by tablename;
查询所有业务表名称及表描述
select tablename,obj_description(relfilenode,'pg_class') from pg_tables a, pg_class b
where a.tablename = b.relname and a.tablename not like 'pg%' and a.tablename not like 'sql_%' order by a.tablename;
查询某表的字段信息
select a.attname as fieldname, col_description(a.attrelid,a.attnum) as comment,format_type(a.atttypid,a.atttypmod) as type, a.attnotnull as notnull
from pg_class as c,pg_attribute as a
where c.relname = '表名称' and a.attrelid = c.oid and a.attnum > 0;
ConstXiong 备案号:苏ICP备16009629号-3