NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #510 most downloaded on PyPI
Connection Pool for Psycopg
Last release 12 days ago
22 Sep 2026
Ships fairly regularly
a new release about every 3 months
Most releases are documented
notes for 24 of 27 stable releases
Nothing withdrawn
no release was ever pulled
5 years old
28 releases · first in 2021
One column per quarter.
Retain Error.pgconn when raising a single exception for multiple connection attempt errors (:ticket: #1246 ).
Error.pgconn when raising a single exception for multiple connection#1246).ErrorResponse for a Sync afterParse (:ticket:#1260).Fix sync pool workers terminating after 24 hours with no task to run (ticket #1419 ).
Retain Error.pgconn when raising a single exception for multiple connection attempt errors (#1246).
Return a proper error when server sends ErrorResponse for a Sync after a Parse (#1260).
Fix race condition in adapters at startup (:ticket: #1230 ).
Fix race condition in adapters at startup (:ticket:#1230).
Propagate cancellation and other base exceptions raised in connection check (ticket #1401 ).
Fix iteration on server-side cursors (:ticket: #1226 ).
Fix iteration on server-side cursors (:ticket:#1226).
Fix residual race condition catching CancelledError on connection (ticket #1275 ).
Fix race condition constructing the lock that makes sync open() thread-safe (ticket #1300 ).
Add drain() method (ticket #1215 ).
Allow the conninfo and kwargs ConnectionPool parameters to be callable to allow connection parameters update (ticket #851 ).
Add close_returns ConnectionPool parameter for integration with SQLAlchemy (ticket #1046 ).
Fix iteration on server-side cursors (#1226).
New top-level features
Add template strings queries (#1054).
More flexible composite adaptation: it is now possible to adapt Python objects to PostgreSQL composites and back even if they are not sequences or if they take keyword arguments (#932, #1202).
Cursors are now iterators, not just iterables. This means you can call next(cur) or anext(cur), which is useful as a type-safe expression (#1064).
Add Cursor.set_result() and Cursor.results() to move across the result sets of queries executed though ~Cursor.executemany() or ~Cursor.execute() with multiple statements (#1080, #1170).
Add transaction-status to report the status during and after a ~Connection.transaction() block (#969).
Allow to change loaders using ~adapt.AdaptersMap.register_loader() on Cursor.adapters after a query result has been already returned (#884).
New libpq wrapper features
Add pq.PGconn.used_gssapi attribute and Capabilities.has_used_gssapi() function (#1138).
Add ConnectionInfo.full_protocol_version attribute, Capabilities.has_full_protocol_version() function (#1079).
Other changes
Disable default GSSAPI preferential connection in the binary package (#1136).
Warning
Please explicitly set the gssencmode_ connection parameter or the PGGSSENCMODE environment variable to interact reliably with the GSSAPI.
Drop support for Python 3.8 (#976) and 3.9 (#1056).
Add :ref: template strings queries <template-strings> (:ticket: #1054 ).
New top-level features
template strings queries <template-strings> (:ticket:#1054).composite adaptation<adapt-composite>: it is now possible#932, 🎫#1202).next\ (cur) or anext\ (cur), which is useful as a :ref:type-safe expression <typing-fetchone> (:ticket:#1064).Cursor.set_result() and Cursor.results() to move across the result~Cursor.executemany() or~Cursor.execute() with multiple statements (:tickets:#1080, #1170).transaction-status to report the status during and after a~Connection.transaction() block (:ticket:#969).~adapt.AdaptersMap.register_loader() onCursor.adapters after a query result has been already returned#884).New libpq wrapper features
pq.PGconn.used_gssapi attribute and Capabilities.has_used_gssapi()#1138).ConnectionInfo.full_protocol_version attribute,Capabilities.has_full_protocol_version() function (:ticket:#1079).Other changes
#1136).#976) and 3.9 (:ticket:#1056).- Don’t lose connections if a CancelledError is raised on check, rollback, or other events (tickets #1123 , #1208 ).
Don’t lose connections if a CancelledError is raised on check, rollback, or other events (tickets #1123 , #1208 ).
Fix DateFromTicks and TimeFromTicks return values to return a date and a time referred to the UTC timezone rather than to the local timezone. For consistency, TimestampFromTicks to return a datetime in UTC rather than in the local timezone (#1058).
Fix ~Cursor.rownumber after using ~AsyncServerCursor.scroll() on AsyncServerCursor (#1066).
Fix interval parsing with days or other parts and negative time in C module (#1071).
Don't process further connection attempts after Ctrl-C (#1077).
Fix cursors to correctly iterate over rows even if their row factory returns None (#1073).
Fix ConnectionInfo.port when the port is specified as an empty string (#1078).
Report all the attempts error messages in the exception raised for a connection failure (#1069).
Improve logging on connection (#1085).
Add support for PostgreSQL 18 libpq (#1082).
- Fix infinite loop with connections modified to return on close (ticket #1124 ).
Fix infinite loop with connections modified to return on close (ticket #1124 ).
Fix request of excessive connections upon connection close failing and retrying (ticket #1176 ).
Add SRID support to shapely dumpers/loaders (#1028).
Add support for binary hstore (#1030).
- Reset transaction status of connection failing check (ticket #1014 ).
Reset transaction status of connection failing check (ticket #1014 ).
Fix connection semantic when using target_session_attrs=prefer-standby (#1021).
- Fix spurious warning logging on pool shrinking (ticket #1001 ).
Fix spurious warning logging on pool shrinking (ticket #1001 ).
- Add a hint to the warning printed if threads fail to stop during __del__ , which has been reported happening during interpreter shutdown on Python 3
Add a hint to the warning printed if threads fail to stop during del , which has been reported happening during interpreter shutdown on Python 3.13 (see ticket #954 ).
Don't lose notifies received whilst the ~Connection.notifies() iterator is not running (#962).
Warning
If you were using notifications to bridge the time between issuing a LISTEN on a channel and starting the iterator you might receive duplicate notifications.
Make sure that the notifies callback is called during the use of the ~Connection.notifies() generator (#972).
Raise the correct error returned by the database (such as !AdminShutdown or !IdleInTransactionSessionTimeout) instead of a generic OperationalError when a server error causes a client disconnection (#988).
Build macOS dependencies from sources instead using the Homebrew versions in order to avoid problems with MACOSX_DEPLOYMENT_TARGET (#858).
Bump libpq to 17.2 in Linux and macOS binary packages.
Bump libpq to 16.4 in Windows binary packages, using the vcpkg library (#966).
- Add metadata to declare compatibility with Python 3.13.
Add metadata to declare compatibility with Python 3.13.
- Raise a RuntimeWarning instead of a DeprecationWarning if an async pool is open in the constructor.
Raise a RuntimeWarning instead of a DeprecationWarning if an async pool is open in the constructor.
Fix connections possibly left in the pool after closing (ticket #784 ).
Use an empty query instead of SELECT 1 to check connections (ticket #790 ).
Drop !TypeDef specifications as string from public modules, as they cannot be composed by users as !typing objects previously could (#860).
Release Python 3.13 binary packages.
- Respect the timeout parameter on connection() when check fails. Also avoid a busy-loop of checking; separate check attempts using an exponential bac
Respect the timeout parameter on connection() when check fails. Also avoid a busy-loop of checking; separate check attempts using an exponential backoff (ticket #709 ).
Use typing.Self as a more correct return value annotation of context managers and other self-returning methods (see ticket 708 ).
Add support for async reconnect_failed callbacks in AsyncConnectionPool (ticket #520 ).
Add check parameter to the pool constructor and check_connection() method. (ticket #656 ).
Make connection pool classes generic on the connection type (ticket #559 ).
Raise a warning if sync pools rely an implicit open=True and the pool context is not used. In the future the default will become False (ticket #659 ).
Raise a warning if async pools are opened in the constructor. In the future it will become an error. (ticket #659 ).
Fix packaging metadata breaking [c], [binary] dependencies (#853).
New top-level features
Add support for integer, floating point, boolean NumPy scalar types (#332).
Add !timeout and !stop_after parameters to Connection.notifies() (340).
Allow dumpers to return !None, to be converted to NULL (#377).
Add raw-query-cursors to execute queries using placeholders in PostgreSQL format ($1, $2...) (#560, #839).
Add capabilities object to inspect the libpq capabilities (#772).
Add ~rows.scalar_row to return scalar values from a query (#723).
Add ~Connection.cancel_safe() for encrypted and non-blocking cancellation when using libpq v17. Use such method internally to implement !KeyboardInterrupt and ~cursor.copy termination (#754).
The !context parameter of sql objects ~sql.Composable.as_string() and ~sql.Composable.as_bytes() methods is now optional (#716).
Add ~Connection.set_autocommit() on sync connections, and similar transaction control methods available on the async connections.
Add a size parameter to ~Cursor.stream() to enable results retrieval in chunks instead of row-by-row (#794).
New libpq wrapper features
Add support for libpq functions to close prepared statements and portals introduced in libpq v17 (#603).
Add support for libpq encrypted and non-blocking query cancellation functions introduced in libpq v17 (#754).
Add support for libpq function to retrieve results in chunks introduced in libpq v17 (#793).
Add support for libpq function to change role passwords introduced in libpq v17 (#818).
Other changes
Drop support for Python 3.7.
Prepared statements are now compatible with PgBouncer. (#589).
Disable receiving more than one result on the same cursor in pipeline mode, to iterate through ~Cursor.nextset(). The behaviour was different than in non-pipeline mode and not totally reliable (#604). The Cursor now only preserves the results set of the last ~Cursor.execute(), consistently with non-pipeline mode.
Nothing published for this version
- Fix the return type annotation of NullConnectionPool.__enter__() (ticket #540 ).
Fix the return type annotation of NullConnectionPool.enter() (ticket #540 ).
Fix TypeInfo.fetch() using a connection in !sql_ascii encoding (#503).
Fix "filedescriptor out of range" using a large number of files open in Python implementation (#532).
Allow JSON dumpers to be registered on !dict or any other object, as was possible in psycopg2 (#541).
Fix canceling running queries on process interruption in async connections (#543).
Fix loading ROW values with different types in the same query using the binary protocol (#545).
Fix dumping recursive composite types (#547).
- Enforce connections’ max_lifetime on check() (ticket #482 ).
Enforce connections’ max_lifetime on check() (ticket #482 ).
Don't pollute server logs when types looked for by TypeInfo.fetch() are not found (#473).
Set Cursor.rowcount to the number of rows of each result set from ~Cursor.executemany() when called with !returning=True (#479).
Fix TypeInfo.fetch() when used with ClientCursor (#484).
- Fix handling of tasks cancelled while waiting in async pool queue (ticket #503 ).
Fix handling of tasks cancelled while waiting in async pool queue (ticket #503 ).
- Declare all parameters in pools constructors, instead of using kwargs (ticket #493 ).
Declare all parameters in pools constructors, instead of using **kwargs (ticket #493 ).
- Make sure that ConnectionPool.check() refills an empty pool (ticket #438 ).
Make sure that ConnectionPool.check() refills an empty pool (ticket #438 ).
Avoid error in Pyright caused by aliasing TypeAlias (ticket #439 ).
Fix array loading slowness compared to psycopg2 (#359).
Improve performance around network communication (#414).
Return !bytes instead of !memoryview from pq.Encoding methods (#422).
Fix Cursor.rownumber to return !None when the result has no row to fetch (#437).
Avoid error in Pyright caused by aliasing !TypeAlias (#439).
Fix Copy.set_types() used with varchar and name types (#452).
Improve performance using row-factories (#457).
- Fix async pool exhausting connections, happening if the pool is created before the event loop is started (ticket #219 ).
Fix async pool exhausting connections, happening if the pool is created before the event loop is started (ticket #219 ).
Include error classes defined in PostgreSQL 15.
Add support for Python 3.11 (#305).
Build binary packages with libpq from PostgreSQL 15.0.
- Add support for Python 3.11 (ticket #305 ).
Add support for Python 3.11 (ticket #305 ).
Restore the state of the connection if Cursor.stream() is terminated prematurely (#382).
Fix regression introduced in 3.1 with different named tuples mangling rules for non-ascii attribute names (#386).
Fix handling of queries with escaped percent signs (%%) in ClientCursor (#399).
Fix possible duplicated BEGIN statements emitted in pipeline mode (#401).
- Fix possible failure to reconnect after losing connection from the server (ticket #370 ).
Fix possible failure to reconnect after losing connection from the server (ticket #370 ).
Fix handling of certain invalid time zones causing problems on Windows (#371).
Fix segfault occurring when a loader fails initialization (#372).
Fix invalid SAVEPOINT issued when entering Connection.transaction() within a pipeline using an implicit transaction (#374).
Fix queries with repeated named parameters in ClientCursor (#378).
Distribute macOS arm64 (Apple M1) binary packages (#344).
- Fix race condition on pool creation which might result in the pool not filling (ticket #230 ).
Fix race condition on pool creation which might result in the pool not filling (ticket #230 ).
Add Null connection pools (ticket #148 ).
Add ConnectionPool.open() and open parameter to the pool constructor (ticket #151 ).
Drop support for Python 3.6.
Work around broken Homebrew installation of the libpq in a non-standard path (#364)
Fix possible "unrecognized service" error in async connection when no port is specified (#366).
Add Pipeline mode (#74).
Add client-side-binding-cursors (#101).
Add CockroachDB support in psycopg.crdb (#313).
Add Two-Phase Commit support (#72).
Add adapt-enum (#274).
Add returning parameter to ~Cursor.executemany() to retrieve query results (#164).
~Cursor.executemany() performance improved by using batch mode internally (#145).
Add parameters to ~Cursor.copy().
Add COPY Writer objects.
Resolve domain names asynchronously in AsyncConnection.connect() (#259).
Add pq.PGconn.trace() and related trace functions (#167).
Add prepare_threshold parameter to Connection init (#200).
Add cursor_factory parameter to Connection init.
Add Error.pgconn and Error.pgresult attributes (#242).
Restrict queries to be ~typing.LiteralString as per 675 (#323).
Add explicit type cast to values converted by sql.Literal (#205).
Drop support for Python 3.6.
Nothing published for this version
- Raise ValueError if ConnectionPool min_size and max_size are both set to 0 (instead of hanging).
Raise ValueError if ConnectionPool min_size and max_size are both set to 0 (instead of hanging).
Raise PoolClosed calling wait() on a closed pool.
Release musllinux binary packages, compatible with Alpine Linux (#141).
Reduce size of binary package by stripping debug symbols (#142).
Include typing information in the !psycopg_binary package.
- Remove dependency on the internal psycopg._compat module.
Remove dependency on the internal psycopg._compat module.
Fix type hint for sql.SQL.join() (#127).
Fix type hint for Connection.notifies() (#128).
Fix call to MultiRange.__setitem__() with a non-iterable value and a slice, now raising a TypeError (#129).
Fix disable cursors methods after close() (#125).
- Don’t leave connections idle in transaction after calling check() (ticket #144 ).
Don’t leave connections idle in transaction after calling check() (ticket #144 ).
First release on PyPI.
On this page
psycopg_pool release notes
Current release
psycopg_pool 3.3.3
psycopg_pool 3.3.2
psycopg_pool 3.3.1
psycopg_pool 3.3.0
psycopg_pool 3.2.8
psycopg_pool 3.2.7
psycopg_pool 3.2.6
psycopg_pool 3.2.5
psycopg_pool 3.2.4
psycopg_pool 3.2.3
psycopg_pool 3.2.2
psycopg_pool 3.2.1
psycopg_pool 3.2.0
psycopg_pool 3.1.9
psycopg_pool 3.1.8
psycopg_pool 3.1.7
psycopg_pool 3.1.6
psycopg_pool 3.1.5
psycopg_pool 3.1.4
psycopg_pool 3.1.3
psycopg_pool 3.1.2
psycopg_pool 3.1.1
psycopg_pool 3.1.0
psycopg_pool 3.0.3
psycopg_pool 3.0.2
psycopg_pool 3.0.1
psycopg_pool 3.0
Fix use of the wrong dumper reusing cursors with the same query but different parameter types (#112).
First stable release. Changed from 3.0b1:
Add adapt-shapely (#80).
Add adapt-multirange (#75).
Add pq.__build_version__ constant.
Don't use the extended protocol with COPY, (#78, #82).
Add context parameter to ~Connection.connect() (#83).
Fix selection of dumper by oid after ~Copy.set_types().
Drop !Connection.client_encoding. Use ConnectionInfo.encoding to read it, and a SET statement to change it.
Add binary packages for Python 3.10 (#103).
Nothing published for this version
- First public release on PyPI.
First public release on PyPI.
Your coding agent can read these notes before it upgrades. Set up the MCP server →