docs/news.rst
.. currentmodule:: psycopg
.. index:: single: Release notes single: News
psycopg release notesPsycopg 3.3.4 ^^^^^^^^^^^^^
#1280).#1298).~Cursor.statusmessage after ~Cursor.executemany()
(:ticket:#1302).Psycopg 3.3.3 ^^^^^^^^^^^^^
Error.pgconn when raising a single exception for multiple connection
attempt errors (:ticket:#1246).ErrorResponse for a Sync after
a Parse (:ticket:#1260).Psycopg 3.3.2 ^^^^^^^^^^^^^
Fix race condition in adapters at startup (:ticket:#1230).
Psycopg 3.3.1 ^^^^^^^^^^^^^
Fix iteration on server-side cursors (:ticket:#1226).
.. rubric:: New top-level features
template strings queries <template-strings> (:ticket:#1054).composite adaptation<adapt-composite>: 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 (:ticket:#932, :ticket:#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
sets of queries executed though ~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() on
Cursor.adapters after a query result has been already returned
(:ticket:#884)... rubric:: New libpq wrapper features
pq.PGconn.used_gssapi attribute and Capabilities.has_used_gssapi()
function (:ticket:#1138).ConnectionInfo.full_protocol_version attribute,
Capabilities.has_full_protocol_version() function (:ticket:#1079)... rubric:: Other changes
Disable default GSSAPI preferential connection in the binary package
(:ticket:#1136).
.. warning::
Please explicitly set the gssencmode_ connection parameter or the
:envvar:PGGSSENCMODE environment variable to interact reliably with the
GSSAPI.
Drop support for Python 3.8 (:ticket:#976) and 3.9 (:ticket:#1056).
.. _iterators: https://docs.python.org/3/glossary.html#term-iterator .. _iterables: https://docs.python.org/3/glossary.html#term-iterable
Psycopg 3.2.13 ^^^^^^^^^^^^^^
#1205).Cursor.copy() and AsyncCursor.copy() to hold the connection lock
for the entire operation, preventing concurrent access issues (:ticket:#1210).#1216).Psycopg 3.2.12 ^^^^^^^^^^^^^^
#1192).Psycopg 3.2.11 ^^^^^^^^^^^^^^
#1141).wait_c function on Windows (:ticket:#645).#1147).Copy.set_types() in TEXT copy in C version, consistently with
the Python version (:ticket:#1153).#1165).#1155)... _psycopg-3.2.10:
Psycopg 3.2.10 ^^^^^^^^^^^^^^
Fix !TypeError shadowing ~asyncio.CancelledError upon task cancellation
during pipeline execution (:ticket:#1005).
Fix memory leak when lambda/local functions are used as argument for
~.psycopg.types.json.set_json_dumps(), ~.psycopg.types.json.set_json_loads()
(:ticket:#1108).
Fix coordination of ~Cursor.executemany() with other concurrent operations
on other cursors (:ticket:#1130).
Fix leak receiving notifications if the ~Connection.notifies() generator
is not called (:ticket:#1091).
.. warning::
This bugfix required the introduction of a change in :ref:notifies reception <async-notify> behaviour.
If a notification is received when a handler is registered via
~Connection.add_notify_handler() and the ~Connection.notifies()
generator is not running the notification will not be yielded by the
generator. This is a behaviour similar to before Psycopg 3.2.4_, but
notifications are not lost if no handler is registered.
Using both the generator and handlers to receive notifications on the same connection is therefore deprecated and will now generate a runtime warning.
Add support for Python 3.14 (:ticket:#1053).
Fix psycopg_binary.__version__.
Raise a warning if a GSSAPI connection is obtained using the
gssencmode=prefer libpq default (see :ticket:#1136).
.. warning::
In a future Psycopg version the default in the binary package will be
changed to disable. If you need to interact with the GSSAPI reliably
you should explicitly set the gssencmode_ parameter in the connection
string or the :envvar:PGGSSENCMODE environment variable to prefer or
require.
.. _gssencmode: https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNECT-GSSENCMODE
Psycopg 3.2.9 ^^^^^^^^^^^^^
#1088).Psycopg 3.2.8 ^^^^^^^^^^^^^
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 (:ticket:#1058).~Cursor.rownumber after using ~AsyncServerCursor.scroll() on
AsyncServerCursor (:ticket:#1066).#1071).#1077).None (:ticket:#1073).ConnectionInfo.port when the port is specified as an empty string
(:ticket:#1078).#1069).#1085).#1082).Psycopg 3.2.7 ^^^^^^^^^^^^^
#1028).#1030).Psycopg 3.2.6 ^^^^^^^^^^^^^
target_session_attrs=prefer-standby
(:ticket:#1021).Psycopg 3.2.5 ^^^^^^^^^^^^^
#447, #998)... _psycopg-3.2.4:
Psycopg 3.2.4 ^^^^^^^^^^^^^
Don't lose notifies received whilst the ~Connection.notifies() iterator
is not running (:ticket:#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 (:ticket:#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
(:ticket:#988).
Build macOS dependencies from sources instead using the Homebrew versions
in order to avoid problems with MACOSX_DEPLOYMENT_TARGET (:ticket:#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__
(:ticket:#966).
.. __: https://vcpkg.io/en/package/libpq
Psycopg 3.2.3 ^^^^^^^^^^^^^
#852).Psycopg 3.2.2 ^^^^^^^^^^^^^
!TypeDef specifications as string from public modules, as they cannot
be composed by users as !typing objects previously could (:ticket:#860).Psycopg 3.2.1 ^^^^^^^^^^^^^
[c], [binary] dependencies
(:ticket:#853)... rubric:: New top-level features
NumPy scalar types__
(:ticket:#332).!timeout and !stop_after parameters to Connection.notifies()
(:ticket:340).!None, to be converted to NULL (:ticket:#377).raw-query-cursors to execute queries using placeholders in
PostgreSQL format ($1, $2...) (:tickets:#560, #839).capabilities object to :ref:inspect the libpq capabilities <capabilities> (:ticket:#772).~rows.scalar_row to return scalar values from a query (:ticket:#723).~Connection.cancel_safe() for encrypted and non-blocking cancellation
when using libpq v17. Use such method internally to implement
!KeyboardInterrupt and ~cursor.copy termination (:ticket:#754).!context parameter of sql objects ~sql.Composable.as_string() and
~sql.Composable.as_bytes() methods is now optional (:ticket:#716).~Connection.set_autocommit() on sync connections, and similar
transaction control methods available on the async connections.size parameter to ~Cursor.stream() to enable results retrieval in
chunks instead of row-by-row (:ticket:#794)... rubric:: New libpq wrapper features
#603).#754).#793).#818)... rubric:: Other changes
compatible with PgBouncer <pgbouncer>.
(:ticket:#589).~Cursor.nextset(). The behaviour was different than
in non-pipeline mode and not totally reliable (:ticket:#604).
The Cursor now only preserves the results set of the last
~Cursor.execute(), consistently with non-pipeline mode... __: https://numpy.org/doc/stable/reference/arrays.scalars.html#built-in-scalar-types
Psycopg 3.1.20 ^^^^^^^^^^^^^^
#820).#829).#847).#858)Psycopg 3.1.19 ^^^^^^^^^^^^^^
#734).#752).connect_timeout connection parameter as float
(:ticket:#796).#745).Psycopg 3.1.18 ^^^^^^^^^^^^^^
#685).#719).CPython issue #65821__ (:ticket:#725)... __: https://github.com/python/cpython/issues/65821
Psycopg 3.1.17 ^^^^^^^^^^^^^^
#699).typing.Self as a more correct return value annotation of context
managers and other self-returning methods (see :ticket:#708).Psycopg 3.1.16 ^^^^^^^^^^^^^^
#703).Psycopg 3.1.15 ^^^^^^^^^^^^^^
service in connection string (regression in 3.1.13,
:ticket:#694).#695).PGCONNECT_TIMEOUT environment variable to determine
the connection timeout.Psycopg 3.1.14 ^^^^^^^^^^^^^^
interaction with gevent <gevent> (:ticket:#527).#686)... _gevent: https://www.gevent.org/
Psycopg 3.1.13 ^^^^^^^^^^^^^^
DataError instead of whatever internal failure trying to dump a
~datetime.time object with with a !tzinfo specified as
~zoneinfo.ZoneInfo (ambiguous offset, see :ticket:#652).InterruptedError,
consistently with :pep:475 guideline (:ticket:#667).load_balance_hosts connection parameter (:ticket:#674).#679).Psycopg 3.1.12 ^^^^^^^^^^^^^^
#608).~register_*() functions are called repeatedly
(:ticket:#647).Psycopg 3.1.11 ^^^^^^^^^^^^^^
#628).#630).#643).#645).#632).~AsyncCursor.executemany().~AsyncCursor.scroll().#528).Psycopg 3.1.10 ^^^^^^^^^^^^^^
bytes directly instead of str,
for better compatibility with libraries like orjson and msgspec
(:ticket:#569)~Cursor.executemany()) in case an error occurred within the pipeline
(:ticket:#585).connect() to avoid "leaking" an open ~pq.PGconn attached to the
OperationalError in case of connection failure. Error.pgconn is now a
shallow copy of the real libpq connection, and the latter is closed before
the exception propagates (:ticket:#565).#591).!QueryCanceled raised as a consequence (:ticket:#593).Connection.read_only and ~Connection.deferrable to their
default value using !None (:ticket:#612).Psycopg 3.1.9 ^^^^^^^^^^^^^
TypeInfo.fetch() using a connection in !sql_ascii encoding
(:ticket:#503).#532).!dict or any other object, as was
possible in psycopg2 (:ticket:#541).#543).#545).#547).Psycopg 3.1.8 ^^^^^^^^^^^^^
TypeInfo.fetch()
are not found (:ticket:#473).Cursor.rowcount to the number of rows of each result set from
~Cursor.executemany() when called with !returning=True (:ticket:#479).TypeInfo.fetch() when used with ClientCursor (:ticket:#484).Psycopg 3.1.7 ^^^^^^^^^^^^^
#464).Psycopg 3.1.6 ^^^^^^^^^^^^^
cursor.copy() with cursors using row factories (:ticket:#460).Psycopg 3.1.5 ^^^^^^^^^^^^^
#359).#414).!bytes instead of !memoryview from pq.Encoding methods
(:ticket:#422).Cursor.rownumber to return !None when the result has no row to fetch
(:ticket:#437).!TypeAlias (:ticket:#439).Copy.set_types() used with varchar and name types (:ticket:#452).row-factories (:ticket:#457).Psycopg 3.1.4 ^^^^^^^^^^^^^
error classes <sqlstate-exceptions> defined in PostgreSQL 15.#305).Psycopg 3.1.3 ^^^^^^^^^^^^^
Cursor.stream() is terminated
prematurely (:ticket:#382).#386).%%) in ClientCursor
(:ticket:#399).#401).Psycopg 3.1.2 ^^^^^^^^^^^^^
#371).#372).Connection.transaction() within
a pipeline using an implicit transaction (:ticket:#374).ClientCursor (:ticket:#378).#344).Psycopg 3.1.1 ^^^^^^^^^^^^^
#364)#366).Pipeline mode <pipeline-mode> (:ticket:#74).client-side-binding-cursors (:ticket:#101).CockroachDB <https://www.cockroachlabs.com/>__ support in psycopg.crdb
(:ticket:#313).Two-Phase Commit <two-phase-commit> support (:ticket:#72).adapt-enum (:ticket:#274).returning parameter to ~Cursor.executemany() to retrieve query
results (:ticket:#164).~Cursor.executemany() performance improved by using batch mode internally
(:ticket:#145).~Cursor.copy().COPY Writer objects <copy-writers>.AsyncConnection.connect()
(:ticket:#259).pq.PGconn.trace() and related trace functions (:ticket:#167).prepare_threshold parameter to Connection init (:ticket:#200).cursor_factory parameter to Connection init.Error.pgconn and Error.pgresult attributes (:ticket:#242).~typing.LiteralString as per :pep:675
(:ticket:#323).sql.Literal (:ticket:#205).Psycopg 3.0.17 ^^^^^^^^^^^^^^
ctypes implementation
(:ticket:#300).ctypes implementation.Psycopg 3.0.16 ^^^^^^^^^^^^^^
~Cursor.rowcount after SHOW (:ticket:#343).#162).Psycopg 3.0.15 ^^^^^^^^^^^^^^
~Cursor.stream().DataError instead of OverflowError loading binary intervals
out-of-range.manylinux2014 wheel packages (:ticket:#124).Psycopg 3.0.14 ^^^^^^^^^^^^^^
DataError dumping arrays of mixed types (:ticket:#301).#303).#304).Psycopg 3.0.13 ^^^^^^^^^^^^^^
Cursor.stream() slowness (:ticket:#286).#293).Connection.cancel() on a closed connection a no-op instead of an
error.Psycopg 3.0.12 ^^^^^^^^^^^^^^
bytearray/memoryview data too as Copy.write() input
(:ticket:#254).~enum.IntEnum in text mode, Python implementation.Psycopg 3.0.11 ^^^^^^^^^^^^^^
DataError loading arrays with dimensions information (:ticket:#253).#255).#255).Psycopg 3.0.10 ^^^^^^^^^^^^^^
#231).Cursor.description after a COPY ... TO STDOUT operation
(:ticket:#235).#241).Psycopg 3.0.9 ^^^^^^^^^^^^^
Error.sqlstate when an unknown code is received (:ticket:#225).!tzdata package as a dependency on Windows in order to handle time
zones (:ticket:#223).Psycopg 3.0.8 ^^^^^^^^^^^^^
client_encoding specified in the
connection string, if available (:ticket:#194).#198).#203).Psycopg 3.0.7 ^^^^^^^^^^^^^
~Cursor.executemany() with no input sequence
(:ticket:#179).~Cursor.rowcount after an ~Cursor.executemany() returning no
rows (:ticket:#178).Psycopg 3.0.6 ^^^^^^^^^^^^^
Cursor.description if the connection is closed
(:ticket:#172).ServerCursor.close() if the connection is closed
(:ticket:#173).Connection.cursor() if the connection is closed (:ticket:#174).ProgrammingError if out-of-order exit from transaction contexts is
detected (:tickets:#176, #177).!CHECK_STANDBY value to ~pq.ConnStatus enum.Psycopg 3.0.5 ^^^^^^^^^^^^^
#158).#165).Psycopg 3.0.4 ^^^^^^^^^^^^^
#147).-W error mode, related to
!backport.zoneinfo (:ticket:#109).
https://github.com/pganssle/zoneinfo/issues/109`__.CVE-2021-23222 <https://www.postgresql.org/support/security/CVE-2021-23222/>__
(:ticket:#149).Psycopg 3.0.3 ^^^^^^^^^^^^^
#141).#142).!psycopg_binary package.Psycopg 3.0.2 ^^^^^^^^^^^^^
sql.SQL.join() (:ticket:#127).Connection.notifies() (:ticket:#128).MultiRange.__setitem__() with a non-iterable value and a
slice, now raising a TypeError (:ticket:#129).#125).Psycopg 3.0.1 ^^^^^^^^^^^^^
#112).First stable release. Changed from 3.0b1:
adapt-shapely (:ticket:#80).adapt-multirange (:ticket:#75).pq.__build_version__ constant.#78, #82).context parameter to ~Connection.connect() (:ticket:#83).~Copy.set_types().!Connection.client_encoding. Use ConnectionInfo.encoding to read
it, and a :sql:SET statement to change it.#103).Psycopg 3.0b1 ^^^^^^^^^^^^^