Fork me on GitHub

pgsql查询表中字段名,类型,备注以及是否非空

SELECT
col_description ( A.attrelid, A.attnum ) AS COMMENT,
format_type ( A.atttypid, A.atttypmod ) AS TYPE,
A.attname AS NAME,
A.attnotnull AS NOTNULL
FROM
pg_class AS C,
pg_attribute AS A
WHERE
C.relname = 'dm_ass_gp_income'
AND A.attrelid = C.oid
AND A.attnum >0

 

posted @ 2022-01-05 17:12  亲爸爸  阅读(816)  评论(0编辑  收藏  举报