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 = '表名';
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 = '表名';
本文标题:pg(PostgreSQL)查询表结构
本文链接:https://www.haomeiwen.com/subject/nectertx.html
网友评论