- PgBouncer version must be version `1.22`__ or newer.
- PgBouncer `max_prepared_statements`__ must be greater than 0.
- The libpq version on the client must be from PostgreSQL 17 or newer
- (you can check the `~Capabilities.has_pgbouncer_prepared` capability to
- verify it).
+ (you can check the `~Capabilities.has_send_close_prepared()` capability to
+ verify that the libpq implements the features required by PgBouncer).
.. __: https://www.pgbouncer.org/
.. __: https://www.pgbouncer.org/2024/01/pgbouncer-1-22-0
.. automethod:: has_stream_chunked
.. automethod:: has_send_close_prepared
- .. automethod:: has_pgbouncer_prepared
.. seealso:: :ref:`pgbouncer`
"""
return self._has_feature("PGconn.send_close_prepared()", 170000, check=check)
- def has_pgbouncer_prepared(self, check: bool = False) -> bool:
- """Check if prepared statements in PgBouncer are supported.
-
- The feature requires libpq 17.0 and greater.
- """
- return self._has_feature(
- "PgBouncer prepared statements compatibility", 170000, check=check
- )
-
def _has_feature(self, feature: str, want_version: int, check: bool) -> bool:
"""
Check is a version is supported.
("has_cancel_safe", "Connection.cancel_safe()", 17),
("has_stream_chunked", "Cursor.stream() with 'size' parameter greater than 1", 17),
("has_send_close_prepared", "PGconn.send_close_prepared()", 17),
- ("has_pgbouncer_prepared", "PgBouncer prepared statements compatibility", 17),
]