Postgresql查看表结构和字段注释
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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为表名*
以上是关于Postgresql查看表结构和字段注释的主要内容,如果未能解决你的问题,请参考以下文章