pg(PostgreSQL)查询表结构
2022-04-13 本文已影响0人
饱饱想要的灵感
SELECT
a.attname as 字段名,
format_type(a.atttypid,a.atttypmod) as 类型,
a.attnotnull as 非空,
col_description(a.attrelid,a.attnum) as 注释
FROM pg_class as c,pg_attribute as a
WHERE
a.attrelid = c.oid
and a.attnum>0
and c.relname = '表名';