Postgresql获得表字段结构信息包含注释

Select * From (
  Select
    a.relname FTableName,
    b.attname FFieldName,
    format_type(b.atttypid,b.atttypmod) as FFieldType,
    col_description(b.attrelid,b.attnum) FFieldDesc,
    b.attnum FNo,
    b.attnotnull FNotNull
  from
    (select oid, * from pg_class where relnamespace=2200 and reltype>0) a
  left join
    (select * From pg_catalog.pg_attribute where attnum>0 and atttypid>0 ) b
  on a.oid=b.attrelid
) A
Order by ftablename,fno

posted on 2019-02-25 20:29  优乐多  阅读(534)  评论(0编辑  收藏  举报

导航