SELECT
tablename
FROM
pg_tables
WHERE
tablename NOTLIKE'pg%'AND tablename NOTLIKE'sql_%'ORDERBY
tablename;
查看当前表的所有字段
SELECT
C.relname,
A.attname AS NAME,
A.attnotnull AS NOTNULL,
format_type ( A.atttypid, A.atttypmod )ASTYPE,
col_description ( A.attrelid, A.attnum )ASCOMMENTFROM
pg_class AS C,
pg_attribute AS A
WHERE
C.relname ='表名'AND A.attrelid = C.oid
AND A.attnum >0
查看当前所有表的所有字段
SELECT C
.relname,
A.attname AS NAME,
A.attnotnull AS NOTNULL,
format_type ( A.atttypid, A.atttypmod )ASTYPE,
col_description ( A.attrelid, A.attnum )ASCOMMENTFROM
pg_class AS C,
pg_attribute AS A
WHERE
C.relname IN(SELECT tablename FROM pg_tables WHERE tablename NOTLIKE'pg%'AND tablename NOTLIKE'sql_%'ORDERBY tablename )AND A.attrelid = C.oid
AND A.attnum >0