From: Daniele Varrazzo Date: Thu, 13 Jun 2024 21:09:20 +0000 (+0200) Subject: chore(capability): drop has_pgbouncer_prepared() X-Git-Tag: 3.2.0~11^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F835%2Fhead;p=thirdparty%2Fpsycopg.git chore(capability): drop has_pgbouncer_prepared() Document to use the `has_send_closed_prepared()` capability instead, which is a necessary condition for PgBouncer support, and doesn't give the impression to be sufficient. --- diff --git a/docs/advanced/prepare.rst b/docs/advanced/prepare.rst index e376e8e05..98582a4d0 100644 --- a/docs/advanced/prepare.rst +++ b/docs/advanced/prepare.rst @@ -68,8 +68,8 @@ PgBouncer__ middleware, using the following caveats: - 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 diff --git a/docs/api/objects.rst b/docs/api/objects.rst index b79c5833d..5f6e2902e 100644 --- a/docs/api/objects.rst +++ b/docs/api/objects.rst @@ -159,7 +159,6 @@ Libpq capabilities information .. automethod:: has_stream_chunked .. automethod:: has_send_close_prepared - .. automethod:: has_pgbouncer_prepared .. seealso:: :ref:`pgbouncer` diff --git a/psycopg/psycopg/_capabilities.py b/psycopg/psycopg/_capabilities.py index 3ab7fd415..d1f6bb3eb 100644 --- a/psycopg/psycopg/_capabilities.py +++ b/psycopg/psycopg/_capabilities.py @@ -71,15 +71,6 @@ class Capabilities: """ 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. diff --git a/tests/test_capabilities.py b/tests/test_capabilities.py index 17fb96560..6f7b55e43 100644 --- a/tests/test_capabilities.py +++ b/tests/test_capabilities.py @@ -18,7 +18,6 @@ caps = [ ("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), ]