Skip to content

pgdriver: provide an option to disable prepared statements for PgBouncer in pool_mode = transaction #1269

@oleg-kuzmenko

Description

@oleg-kuzmenko

Problem
When using Bun with pgdriver behind PgBouncer in pool_mode = transaction, queries often fail with:

ERROR: unnamed prepared statement does not exist (SQLSTATE=26000)

This happens because pgdriver always uses the extended query protocol with prepared statements.
But in transaction pooling mode, PgBouncer reuses backend connections across clients, and any prepared statements created on one connection do not survive reassignment.

As a result, Bun + pgdriver cannot be reliably used with PgBouncer in pool_mode=transaction.

pgdriver should provide a way to disable prepared statements and force the simple query protocol, similar to:
• pgx: PreferSimpleProtocol = true
• libpq: prefer_simple_protocol=1

This would make Bun + pgdriver compatible with PgBouncer in transaction mode.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions