-- 获取所有table名
SELECT
	tablename
FROM
	pg_tables
WHERE
	tablename NOT LIKE 'pg%'
AND tablename NOT LIKE 'sql_%'
AND schemaname = 'public'
ORDER BY
	tablename;

--获取pg库中所有table名以及table的注解信息 
SELECT
	tablename,
	obj_description (relfilenode, 'pg_class')
FROM
	pg_tables A,
	pg_class b
WHERE
	A .tablename = b.relname
AND A .schemaname = 'public'
AND A .tablename NOT LIKE 'pg%'
AND A .tablename NOT LIKE 'sql_%';

SELECT * FROM pg_attribute
--pg获取制定table的所有字段信息 
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 = 'yuhang_road'--指定表
AND A .attrelid = C .oid
AND A .attnum > 0;