1

I have a C# app connecting to a postgres database, through pg_bouncer, using Npgsql. In my connection string, I include SearchPath. Npgsql picks this up and sets the search_path parameter in the startup packet.

Pg_bouncer seems to not like that search_path parameter, which would cause the initial connection to fail (Unsupported startup parameter: search_path). To get around this, we listed it in the ignore_startup_parameters list for pg_bouncer.

The connection now gets through to the database fine, but totally ignores any SearchPath declared in the connection string. Every query now, instead of hitting the correct schema, selects out of the Public schema.

How can I get Postgres to respect the SearchPath again?

4

1 回答 1

2

您可以为要连接的角色设置默认值search_path(永久):

ALTER ROLE foo SET search_path=blarg,public;

或者对于整个数据库,取决于您的确切要求。您甚至可以SET在会话/事务的顶部发布一个简单的声明。search_path在 Postgres 中有多种设置方法。详细说明:

于 2015-03-11T18:56:29.217 回答