Postgresql查看表结构和字段注释

前端之家收集整理的这篇文章主要介绍了Postgresql查看表结构和字段注释前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

Postgresql查看表结构和字段注释

一:查看表结构(字段)信息:
Select table_name,column_name,data_type,character_maximum_length from information.columns where table_schema='dd' and table_name='department';
二:查看字段注释信息:
Select a.attnum,(select description from pg_catalog.pg_description where objoid=a.attrelid and objsubid=a.attnum) as descript,a.attname,pg_catalog.format_type(a.atttypid,a.atttypmod) as data_type from pg_catalog.pg_attribute a where 1=1 and a.attrelid=(select oid from pg_class where relname='department' ) and a.attnum>0 and not a.attisdropped order by a.attnum;

  • 注释:其中dd为schema名字,department为表名*
原文链接:https://www.f2er.com/postgresql/193286.html

猜你在找的Postgre SQL相关文章