Skip to content
Back to the playbook

Fixing 'prepared statement does not exist' under PgBouncer transaction pooling

PgBouncerPostgreSQLrevision 1

Diagnostic tree

  1. In progressA named prepared statement 'does not exist'This surfaces through PgBouncer, but the underlying mechanism is about which Postgres backend connection actually has the statement prepared.
View the whole map (7 more steps)
  • Confirm the pool is in transaction (or statement) pooling mode
  • Transaction pooling reassigns server connections between statements
  • pool_mode is session, not transaction/statement
  • Check PgBouncer's version, then use native prepared-statement tracking or turn it off client-side
  • Confirm the errors stop and the setting is active
  • Resolved
  • If you can't upgrade PgBouncer yet, stop using named prepared statements against the pooled connection

What to test

A named prepared statement 'does not exist'

This surfaces through PgBouncer, but the underlying mechanism is about which Postgres backend connection actually has the statement prepared.

What happened?