本篇文章可能有錯,尚未細細研究
運行\d出錯:
No relations found.
\d只顯示可見的表,也就是該數據庫的schema在search_path中。
SHOW search_path;
如果沒有,設置一下:
SET search_path= tran;
其中tran是要查詢的schema。
如果\d仍然出錯,查看一下訪問權限:
\dn+
如果輸出:
List of schemas Name | Owner | Access privileges | Description --------+----------+----------------------+------------------------ public | postgres | postgres=UC/postgres+| standard public schema | | =UC/postgres | tran | postgres | | | | |
tran行的Access privileges為空,添加權限:
grant all on SCHEMA tran to public;
運行\dn+,這時輸出:
List of schemas Name | Owner | Access privileges | Description --------+----------+----------------------+------------------------ public | postgres | postgres=UC/postgres+| standard public schema | | =UC/postgres | tran | postgres | postgres=UC/postgres+| | | =UC/postgres |