postgresql中的search_path

search_path類似於linux中的path環境變量。
postgres=# show search_path;
   search_path   
-----------------
 "$user", public
(1 row)

默認值是$user,public,意思就是當以某個用戶登錄到數據庫的時候,默認就是先查找和登錄用戶同名的schema,再查找public。

修改search_path:

postgres=# set search_path = schema_name1,schema_name2,...;

或者

postgres=# set search_path to schema_name1,schema_name2,...;

恢復:

postgres=# set search_path = "$user", public;



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章