SELECT A ?? ?.attnum AS "序号", ?? ?C.relname AS "表名", ?? ?CAST ( obj_description ( relfilenode, 'pg_class' ) AS VARCHAR ) AS "表名描述", ?? ?A.attname AS "字段名", ?? ?A.attnotnull AS "是否为空", --IF ( A.attnotnull = 'f', '是', '否' ) AS '必填', ?? ?concat_ws ( '', T.typname, SUBSTRING ( format_type ( A.atttypid, A.atttypmod ) FROM '\(.*\)' ) ) AS "数据类型", ?? ?d.description AS "注释"? FROM ?? ?pg_class C, ?? ?pg_attribute A, ?? ?pg_type T, ?? ?pg_description d? ?? ?WHERE--C.relname ='实际表名' ?? ?1 = 1? ?? ?AND A.attnum > 0? ?? ?AND A.attrelid = C.oid? ?? ?AND A.atttypid = T.oid? ?? ?AND d.objoid = A.attrelid? ?? ?AND d.objsubid = A.attnum? ORDER BY ?? ?C.relname DESC, ?? ?A.attnum ASC?
?
|