What’s new in psycopg 2.2
This is the first release of the new 2.2 series, supporting not just one but
two different ways of executing asynchronous queries, thanks to Jan and Daniele
(with a little help from me and others, but they did 99% of the work so they
deserve their names here in the news.)
psycopg now supports both classic select() loops and “green” coroutine
libraries. It is all in the documentation, so just point your browser to
Other new features:
- truncate() method for lobjects.
- COPY functions are now a little bit faster.
- All builtin PostgreSQL to Python typecasters are now available from the
- Notifications from the backend are now available right after the execute()
call (before client code needed to call isbusy() to ensure NOTIFY
- Better timezone support.
- Lots of documentation updates.
- Fixed some gc/refcounting problems.
- Fixed reference leak in NOTIFY reception.
- Fixed problem with PostgreSQL not casting string literals to the correct
types in some situations: psycopg now add an explicit cast to dates, times
and bytea representations.
- Fixed TimestampFromTicks() and TimeFromTicks() for seconds >= 59.5.
- Fixed spurious exception raised when calling C typecasters from Python
What’s new in psycopg 2.0.14
- Support for adapting tuples to PostgreSQL arrays is now enabled by
default and does not require importing psycopg2.extensions anymore.
- “can’t adapt” error message now includes full type information.
- Thank to Daniele Varrazzo (piro) psycopg2’s source package now includes
full documentation in HTML and plain text format.
- No loss of precision when using floats anymore.
- decimal.Decimal “nan” and “infinity” correctly converted to PostgreSQL
numeric NaN values (note that PostgreSQL numeric type does not support
infinity but just NaNs.)
- psycopg2.extensions now includes Binary.
It seems we’re good citizens of the free software ecosystem and that big
big big companies and people ranting on the pgsql-hackers mailing list
we’ll now not dislike us. g (See LICENSE file for the details.)
What’s new in psycopg 2.0.13
- Support for UUID arrays.
- It is now possible to build psycopg linking to a static libpq
- Fixed a deadlock related to using the same connection with
multiple cursors from different threads.
- Builds again with MSVC.
What’s new in psycopg 2.0.12
- The connection object now has a reset() method that can be used to
reset the connection to its default state.
- copy_to() and copy_from() now accept a much larger number of columns.
- Fixed PostgreSQL version detection.
- Fixed ZPsycopgDA version check.
- Fixed regression in ZPsycopgDA that made it behave wrongly when
receiving serialization errors: now the query is re-issued as it
should be by propagating the correct exception to Zope.
- Writing “large” large objects should now work.
What’s new in psycopg 2.0.11
- DictRow and RealDictRow now use less memory. If you inherit on them
remember to set __slots__ for your new attributes or be prepare to
go back to old memory usage.
- Fixed exception in setup.py.
- More robust detection of PostgreSQL development versions.
- Fixed exception in RealDictCursor, introduced in 2.0.10.
What’s new in psycopg 2.0.10
- A specialized type-caster that can parse time zones with seconds is
now available. Note that after enabling it (see extras.py) “wrong”
time zones will be parsed without raising an exception but the
result will be rounded.
- DictCursor can be used as a named cursor.
- DictRow now implements more dict methods.
- The connection object now expose PostgreSQL server version as the
.server_version attribute and the protocol version used as
- The connection object has a .get_parameter_status() methods that
can be used to obtain useful information from the server.
- None is now correctly always adapted to NULL.
- Two double memory free errors provoked by multithreading and
garbage collection are now fixed.
- Fixed usage of internal Python code in the notice processor; this
should fix segfaults when receiving a lot of notices in
- Should build again on MSVC and Solaris.
- Should build with development versions of PostgreSQL (ones with
-devel version string.)
- Fixed some tests that failed even when psycopg was right.
What’s new in psycopg 2.0.9
- “import psycopg2.extras” to get some support for handling times
and timestamps with seconds in the time zone offset.
- DictCursors can now be used as named cursors.
- register_type() now accept an explicit None as its second parameter.
- psycopg2 should build again on MSVC and Solaris.
What’s new in psycopg 2.0.9
- COPY TO/COPY FROM queries now can be of any size and psycopg will
correctly quote separators.
- float values Inf and NaN are now correctly handled and can
round-trip to the database.
- executemany() now return the numer of total INSERTed or UPDATEd
rows. Note that, as it has always been, executemany() should not
be used to execute multiple SELECT statements and while it will
execute the statements without any problem, it will return the
- copy_from() and copy_to() can now use quoted separators.
- “import psycopg2.extras” to get UUID support.
- register_type() now works on connection and cursor subclasses.
- fixed a memory leak when using lobjects.
What’s new in psycopg 2.0.8
- The connection object now has a get_backend_pid() method that
returns the current PostgreSQL connection backend process PID.
- The PostgreSQL large object API has been exposed through the
- Some fixes to ZPsycopgDA have been merged from the Debian package.
- A memory leak was fixed in Cursor.executemany().
- A double free was fixed in pq_complete_error(), that caused crashes
under some error conditions.
What’s new in psycopg 2.0.7
Improved error handling:
- All instances of psycopg2.Error subclasses now have pgerror,
pgcode and cursor attributes. They will be set to None if no
value is available.
- Exception classes are now chosen based on the SQLSTATE value from
the result. (#184)
- The commit() and rollback() methods now set the pgerror and pgcode
attributes on exceptions. (#152)
- errors from commit() and rollback() are no longer considered
- If a disconnect is detected during execute(), an exception will be
raised at that point rather than resulting in “ProgrammingError:
no results to fetch” later on. (#186)
Better PostgreSQL compatibility:
- If the server uses standard_conforming_strings, perform
- BC dates are now handled if psycopg is compiled with mxDateTime
support. If using datetime, an appropriate ValueError is
Other bug fixes:
- If multiple sub-interpreters are in use, do not share the Decimal
type between them. (#192)
- Buffer objects obtained from psycopg are now accepted by psycopg
too, without segfaulting. (#209)
- A few small changes were made to improve DB-API compatibility.
All the dbapi20 tests now pass.
- The PSYCOPG_DISPLAY_SIZE option is now off by default. This means
that display size will always be set to “None” in
cursor.description. Calculating the display size was expensive,
and infrequently used so this should improve performance.
- New QueryCanceledError and TransactionRollbackError exceptions
have been added to the psycopg2.extensions module. They can be
used to detect statement timeouts and deadlocks respectively.
- Cursor objects now have a “closed” attribute. (#164)
- If psycopg has been built with debug support, it is now necessary
to set the PSYCOPG_DEBUG environment variable to turn on debug
What’s new in psycopg 2.0.6
Better support for PostgreSQL, Python and win32:
- full support for PostgreSQL 8.2, including NULLs in arrays
- support for almost all existing PostgreSQL encodings
- full list of PostgreSQL error codes available by importing the
- full support for Python 2.5 and 64 bit architectures
- better build support on win32 platform
Support for per-connection type-casters (used by ZPsycopgDA too, this
fixes a long standing bug that made different connections use a random
set of date/time type-casters instead of the configured one.)
Better management of times and dates both from Python and in Zope.
copy_to and copy_from now take an extra “columns” parameter.
Python tuples are now adapted to SQL sequences that can be used with
the “IN” operator by default if the psycopg2.extensions module is
imported (i.e., the SQL_IN adapter was moved from extras to extensions.)
Fixed some small buglets and build glitches:
- removed double mutex destroy
- removed all non-constant initializers
- fixed PyObject_HEAD declarations to avoid memory corruption
on 64 bit architectures
- fixed several Python API calls to work on 64 bit architectures
- applied compatibility macros from PEP 353
- now using more than one argument format raise an error instead of
What’s new in psycopg 188.8.131.52
- Now it really, really builds on MSVC and older gcc versions.
What’s new in psycopg 2.0.5
- Fixed various buglets such as:
- segfault when passing an empty string to Binary()
- segfault on null queries
- segfault and bad keyword naming in .executemany()
- OperationalError in connection objects was always None
- Various changes to ZPsycopgDA to make it more zope2.9-ish.
- connect() now accept both integers and strings as port parameter
What’s new in psycopg 2.0.4
- Fixed float conversion bug introduced in 2.0.3.
What’s new in psycopg 2.0.3
- Fixed various buglets and a memory leak (see ChangeLog for details)
What’s new in psycopg 2.0.2
- Fixed a bug in array typecasting that sometimes made psycopg forget about
the last element in the array.
- Fixed some minor buglets in string memory allocations.
- Builds again with compilers different from gcc (#warning about PostgreSQL
version is issued only if __GCC__ is defined.)
What’s new in psycopg 2.0.1
- ZPsycopgDA now actually loads.