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

猜你喜欢

转载自www.cnblogs.com/wuxuan/p/10433169.html