查看pg数据库的表名字段详细描述信息语句
程序员文章站
2024-03-21 10:52:28
...
select t1.schemaname,t1.tablename,t1.tableowner,t3.attname,t3.attnum,format_type(t3.atttypid,t3.atttypmod),t5.description
from pg_tables t1
left join pg_namespace t4
on t1.schemaname=t4.nspname
left join PG_class t2
on t1.tablename=t2.relname
and t4.oid=t2.relnamespace
left join pg_attribute t3
on t2.oid=t3.attrelid
and t3.attnum>0
left join pg_description t5
on t3.attrelid=t5.objoid
and t3.attnum=t5.objsubid
where t1.schemaname='odsdata'-- and t1.tablename='f_ats_beps_batbuysum_s'
and t1.tablename not like '%_prt_%'
order by t1.tablename,t3.attnum
表以及表描述
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;
上一篇: 析构函数可以调用虚函数,构造函数为什么不可以调用虚函数
下一篇: 如何在psql中切换数据库?