转载自http://www.cnblogs.com/lucoo/p/5712585.html
SELECT viewname FROM pg_views WHERE schemaname ='public'@H_301_26@
SELECT tablename FROM pg_tables
WHERE tablename NOT LIKE pg%'
AND tablename NOT LIKE sql_%'
ORDER BY tablename;
@H_301_26@
postgresql获取某个表tablename 所有字段名称 , 类型,备注,是否为空 等
SELECT col_description(a.attrelid,a.attnum) as comment,pg_type.typname as typename,a.attname as name,a.attnotnull as notnull
FROM pg_class as c,pg_attribute as a inner join pg_type on pg_type.oid = a.atttypid
where c.relname = tablename' and a.attrelid = c.oid and a.attnum>0
@H_301_26@
postgresql获取某个表tablename 的主键信息