KingbaseES查询表字段及属性
方法如下:
select
a.attnum,
a.attname as field,
t.typname as type,
a.attlen as length,
a.atttypmod as lengthvar,
a.attnotnull as notnull,
b.description as comment
from
sys_class c,
sys_attribute a
left outer join sys_description b on
a.attrelid = b.objoid
and a.attnum = b.objsubid,
pg_type t
where
c.relname = '表名'
and a.attnum > 0
and a.attrelid = c.oid
and a.atttypid = t.oid
order by
a.attnum;
结果如下: