如何在pgbouncer中设置search_path?

时间:2019-02-21 10:16:34

标签: postgresql pgbouncer

我们使用pgbouncer,其配置文件pgbouncer.ini包含以下内容:

[databases]
file_storage = dbname=file_storage connect_query='SELECT 1' host=172.17.0.1 port=5432 user=usr password=pass 

我们需要在数据库中使用第二个模式,并且可以设置search_path变量,例如这样在connect_query参数中:

file_storage = dbname=file_storage connect_query='SELECT 1; SET search_path TO compat, public;' host=172.17.0.1 port=5432 user=usr password=pass 

但是当我直接连接到数据库时,似乎search_path具有其默认值:

file_storage=# show  search_path ;
 search_path 
-------------
 public
(1 row)

file_storage=# select count(1) from image;
 count 
-------
     0
(1 row)

file_storage=# set search_path to compat, public;
SET
file_storage=# select count(1) from image;
 count  
--------
 199
(1 row)

file_storage=# 

在pgbouncer中设置search_path的位置和意义何在?或至少在postgresql中。

0 个答案:

没有答案