查询字段描述sql-postgresql

查询字段描述sql

 

SELECT 'comment on column ' || n.nspname ||'.'|| c.relname || '.' || a.attname ||' is '''|| col_description(a.attrelid,a.attnum) ||''';'
FROM pg_class as c
join pg_attribute as a on a.attrelid = c.oid
join pg_namespace n on c.relnamespace=n.oid
where n.nspname = 'cty_189' and c.relname = 'jd_template'  and a.attnum>0 and col_description(a.attrelid,a.attnum) is not null
order by attnum ;

 

posted on 2017-09-20 11:06  IT小不点  阅读(1235)  评论(0编辑  收藏  举报