dipdup-io/dipdup

Prepared statement "__asyncpg_stmt_e__" does not exist

pyk opened this issue · 1 comments

pyk commented

Steps to reproduce:

  1. Setup postgres with pgbouncer
  2. run dipdup with the following config
database:
  kind: postgres
  host: ${POSTGRES_HOST}
  port: ${POSTGRES_PORT}
  user: ${POSTGRES_USER}
  password: ${POSTGRES_PASSWORD}
  database: ${POSTGRES_DB}
  schema_name: ${POSTGRES_SCHEMA}

use pgbouncer

What did you expect to happen:
Can run dipdup normally

What actually happened:
I got the following error:

  File "asyncpg/protocol/protocol.pyx", line 207, in bind_execute
asyncpg.exceptions.InvalidSQLStatementNameError: prepared statement "__asyncpg_stmt_e__" does not exist
HINT:  
NOTE: pgbouncer with pool_mode set to "transaction" or
"statement" does not support prepared statements properly.
You have two options:

* if you are using pgbouncer for connection pooling to a
  single server, switch to the connection pool functionality
  provided by asyncpg, it is a much better option for this
  purpose;

* if you have no option of avoiding the use of pgbouncer,
  then you can set statement_cache_size to 0 when creating
  the asyncpg connection object.

Environment

  • Python version: 3.11
  • DipDup version or commit hash: 7.2.2
  • Database engine version: Postgres 15.1.1.2
  • Hasura version:
  • Are you in docker? no
  • Can you reproduce this issue on next?
pyk commented

Oops, my bad. Turns out I had to switch on session mode in pgbouncer. It's all running smoothly now