pgsql查看注释

SELECT c.relname, a.attname as 字段名, col_description(a.attrelid,a.attnum) as 注释,
concat_ws('',t.typname,SUBSTRING(format_type(a.atttypid,a.atttypmod) from '(.*)')) as 字段类型,
concat_ws('', ' COMMENT ON COLUMN public.', c.relname ,'.', a.attname ,' IS null; ') as 去掉注释
FROM pg_class as c, pg_attribute as a, pg_type as t
WHERE a.atttypid = t.oid
and a.attrelid = c.oid
and a.attnum>0
and col_description(a.attrelid,a.attnum) <> '[null]'

posted @ 2022-04-04 10:55  唯起  阅读(376)  评论(0编辑  收藏  举报