postgresql中的search_path

来源:互联网 发布:电竞耳机 知乎 编辑:程序博客网 时间:2024/06/05 05:18
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;



原创粉丝点击