查看schemas
[postgres@node1 ~]$ /usr/pgsql-9.6/bin/psql -h 51.0.1.213 -Ufire firedb
查看schemas
或
firedb=# SELECT nspname FROM pg_namespace;
Owner表示schemas 屬於哪個用戶,Access privileges 表示是否可以訪問。
授權schema
firedb=# grant USAGE on SCHEMA big_emergency_auth to fire;
GRANT

設置set search_path,這里是搜索路徑,如果搜索路徑沒有這個SCHEMA 我們也無法查看到
set search_path TO "$user",public,amp,apolloconfigdb
查看當前SCHEMA
firedb=# show search_path;
"$user", public, amp, apolloconfigdb,
查看表
firedb=#
firedb=# \dt
List of relations
Schema | Name | Type | Owner
--------------------+-----------------------------+-------+-------
amp | amp_auth | table | fire
amp | amp_change_log | table | fire
amp | amp_login_log | table | fire
amp | amp_org | table | fire
amp | amp_org_personnel | table | fire
amp | amp_pw_chg_type | table | fire
amp | amp_role | table | fire
amp | amp_staff | table | fire
amp | amp_staff_auth | table | fire
amp | amp_staff_org | table | fire
amp | amp_staff_role | table | fire
amp | ss_org | table | fire
……………………………….