首页 > 编程学习 > 【pg】取pg数据库某表的字段名、注释和排序号

【SQL】

select 
    attname as name,
    attnum as orderNum,
    col_description(attrelid,attnum) as remark
from pg_attribute
where attrelid='your table'::regclass and attnum>0
order by attnum asc

END

 

Copyright © 2010-2022 mfbz.cn 版权所有 |关于我们| 联系方式|豫ICP备15888888号