查询sql如下:
SELECT a.attname AS field, t.typname AS type, CASE WHEN t.typlen = -1 THEN a.atttypmod - 4 ELSE t.typlen::integer END AS lengthvar, case a.attnotnull when 't' then 'NO' else 'YES' end AS notnull, b.description AS comment FROM pg_class c, pg_attribute a LEFT OUTER JOIN pg_description b ON a.attrelid=b.objoid AND a.attnum = b.objsubid, pg_type t WHERE c.relname = 'data_air_site_day' and a.attnum > 0 and a.attrelid = c.oid and a.atttypid = t.oid ORDER BY a.attnum;
标签:postgresql,attnum,查询,attrelid,sql,type,pg From: https://www.cnblogs.com/tiandi/p/17023441.html