pg中获取表名和字段名
select tablename
from pg_tables
where
schemaname in ('public','ur schema') and tablename in (
select relname
from pg_class
where
relkind = 'r'
AND NOT relispartition is true
and relname not like 'pg_%'
and relname not like 'sql_%'
and relchecks=0 ) order by tablename select viewname from pg_views where schemaname in ('public', 'your schema');
--获取表名,剔除分区分表;获取视图名
SELECT
col_description(a.attrelid,a.attnum) as comment,
pg_type.typname as typename,
a.attname as name,
a.attnotnull as notnull
FROM
pg_class as c,
pg_attribute as a
inner join pg_type on pg_type.oid = a.atttypid
where
c.relname = 'your TableName'
and a.attrelid = c.oid
and a.attnum>0;
--获取表字段
https://www.cnblogs.com/usegear/p/17077962.html