Open skyline-gleb opened 4 years ago
Seems that asyncpg + pgbouncer doesn't work well together unless using pool_mode=session
as per https://github.com/MagicStack/asyncpg/issues/339
It seems the issue is that asyncpg sets up remote state for performance, and pgbouncer is stateless. This is an issue because to do safe parametrised queries postgres requires a two-step instruction (prepare + call) and asyncpg assumes that this is available.
I see there is a suggestion to make pgbouncer work a bit better over here: https://github.com/MagicStack/asyncpg/pull/348#issuecomment-416058033
If the problem goes away if you set the pool_mode, then it is very likely the issue is what is descrivbed there, and we can implement a work-around so it at least works.
Describe the bug Get error from asyncpg when set custom schema in connection credentials:
asyncpg.exceptions.ProtocolViolationError: unsupported startup parameter: search_path
To Reproduce
CREATE SCHEMA IF NOT EXISTS notpublic
Expected behavior Successfully init
Additional context Support schema added in https://github.com/tortoise/tortoise-orm/pull/172 and changed in https://github.com/tortoise/tortoise-orm/pull/229