好不容易搞成,做个笔记
写道
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 = 'tablename' and a.attrelid = c.oid and a.attnum>0
FROM pg_class as c,pg_attribute as a
where c.relname = 'tablename' and a.attrelid = c.oid and a.attnum>0
tablename就是表名了
本文提供了一种使用SQL查询特定表的所有字段及其相关信息的方法,包括字段名称、类型、是否允许为空及注释说明。
2903

被折叠的 条评论
为什么被折叠?



