1 --查看数据库
select * from pg_database;
2 --查看表空间
select * from pg_tablespace;
3 --查看会话进程
select * from pg_stat_activity;
4 --查看某个数据库下的所有表
select * from pg_tables where schemaname = ‘库名’;
5 --查看表的结构
只查看表结构
select * from information_schema.columns
where table_schema=‘public’ and table_name=‘表名’;
查看表结构和注释等详细信息
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 = ‘表名’ and a.attrelid = c.oid and a.attnum>0;