赞
踩
-- 查询表以及表注释
SELECT
"table_name", t2.description
FROM information_schema.tables
left join (select * from pg_description where objsubid = 0) t2 on table_name::regclass::oid = t2.objoid
WHERE table_schema = 'public' AND table_type = 'BASE TABLE';
-- 查询表字段以及类型注释等
select table_name::regclass::oid, "column_name", data_type,
character_maximum_length, t2.description
from information_schema.COLUMNS t1
left join pg_description t2 on t1.dtd_identifier = t2.objsubid::text and t2.objoid = table_name::regclass::oid
where "table_name" = 'tabl_name';
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。