码迷,mamicode.com
首页 > 数据库 > 详细

Postgresql查看表结构和字段注释

时间:2018-01-30 19:44:52      阅读:4255      评论:0      收藏:0      [点我收藏+]

标签:pid   column   har   mod   rtm   order by   mat   imu   block   

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查看表结构和字段注释

标签:pid   column   har   mod   rtm   order by   mat   imu   block   

原文地址:http://blog.51cto.com/newcourage/2066937

(1)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!