- It is now possible to use a custom array cast function by changing
the type caster for the 'anyarray' type. For instance, by calling
set_typecast('anyarray', lambda v, c: v) you can have arrays returned
as strings instead of lists. Note that in the pg module, you can also
call set_array(False) in order to return arrays as strings.
- The namedtuple classes used for the rows of query results are now cached
and reused internally, since creating namedtuples classes in Python is a
somewhat expensive operation. By default the cache has a size of 1024
entries, but this can be changed with the set_row_factory_size() function.
In certain cases this change can notably improve the performance.
Ok from OWNER, darcy.
Version 5.0.2 (2016-09-08)
--------------------------
- Fixed an infinite recursion problem in the DB wrapper class of the classic
module that could occur when the underlying connection could not be properly
opened (bug report by Justin Pryzby).
Version 5.0.1 (2016-08-18)
--------------------------
- The update() and delete() methods of the DB wrapper now use the OID instead
of the primary key if both are provided. This restores backward compatibility
with PyGreSQL 4.x and allows updating the primary key itself if an OID exists.
- The connect() function of the DB API 2.0 module now accepts additional keyword
parameters such as "application_name" which will be passed on to PostgreSQL.
- PyGreSQL now adapts some queries to be able to access older PostgreSQL 8.x
databases (as suggested on the mailing list by Andres Mejia). However, these
old versions of PostgreSQL are not officially supported and tested any more.
- Fixed an issue with Postgres types that have an OID >= 0x80000000 (reported
on the mailing list by Justin Pryzby).
- Allow extra values that are not used in the command in the parameter dict
passed to the query_formatted() method (as suggested by Justin Pryzby).
- Improved handling of empty arrays in the classic module.
- Unused classic connections were not properly garbage collected which could
cause memory leaks (reported by Justin Pryzby).
- Made C extension compatible with MSVC 9 again (this was needed to compile for
Python 2 on Windows).
This is the last version before adding support for Python 3.x. Only bug
fixes will be added to this branch. From the changelog:
Version 4.2
-----------
- The supported Python versions are 2.4 to 2.7.
- PostgreSQL is supported in all versions from 8.3 to 9.5.
- Set a better default for the user option "escaping-funcs".
- Force build to compile with no errors.
- New methods get_parameters() and set_parameters() in the classic interface
which can be used to get or set run-time parameters.
- New method truncate() in the classic interface that can be used to quickly
empty a table or a set of tables.
- Fix decimal point handling.
- Add option to return boolean values as bool objects.
- Add option to return money values as string.
- get_tables() does not list information schema tables any more.
- Fix notification handler (Thanks Patrick TJ McPhee).
- Fix a small issue with large objects.
- Minor improvements in the NotificationHandler.
- Converted documentation to Sphinx and added many missing parts.
- The tutorial files have become a chapter in the documentation.
- Greatly improved unit testing, tests run with Python 2.4 to 2.7 again.
Problems found with existing distfiles:
distfiles/D6.data.ros.gz
distfiles/cstore0.2.tar.gz
distfiles/data4.tar.gz
distfiles/sphinx-2.2.7-release.tar.gz
No changes made to the cstore or mariadb55-client distinfo files.
Otherwise, existing SHA1 digests verified and found to be the same on
the machine holding the existing distfiles (morden). All existing
SHA1 digests retained for now as an audit trail.
Mainly a bug fix. Also adds a preplacement for the functionality of
databases/py-pgnotify which no longer works with new versions of
PyGreSQL and PostgreSQL.
Changes since 4.0:
- Dropped support for Python below 2.5 and PostgreSQL below 8.3.
- Added support for Python up to 2.7 and PostgreSQL up to 9.2.
- Particularly, support PQescapeLiteral() and PQescapeIdentifier().
- The query method of the classic API now supports positional parameters.
This an effective way to pass arbitrary or unknown data without worrying
about SQL injection or syntax errors (contribution by Patrick TJ McPhee).
- The classic API now supports a method namedresult() in addition to
getresult() and dictresult(), which returns the rows of the result
as named tuples if these are supported (Python 2.6 or higher).
- The classic API has got the new methods begin(), commit(), rollback(),
savepoint() and release() for handling transactions.
- Both classic and DBAPI 2 connections can now be used as context
managers for encapsulating transactions.
- The execute() and executemany() methods now return the cursor object,
so you can now write statements like "for row in cursor.execute(...)"
(as suggested by Adam Frederick).
- Binary objects are now automatically escaped and unescaped.
- Bug in money quoting fixed. Amounts of $0.00 handled correctly.
- Proper handling of date and time objects as input.
- Proper handling of floats with 'nan' or 'inf' values as input.
- Fixed the set_decimal() function.
- All DatabaseError instances now have a sqlstate attribute.
- The getnotify() method can now also return payload strings (#15).
- Better support for notice processing with the new methods
set_notice_receiver() and get_notice_receiver()
(as suggested by Michael Filonenko, see #12 and #37).
- Open transactions are rolled back when pgdb connections are closed
(as suggested by Peter Harris, see #46).
- Connections and cursors can now be used with the "with" statement
(as suggested by Peter Harris, see #46).
- New method use_regtypes() that can be called to let getattnames()
return regular type names instead of the simplified classic types (#44).
incompatibilities. Here are the major changes.
- Dropped support for Python below 2.3 and PostgreSQL below 7.4.
- Improved performance of fetchall() for large result sets
by speeding up the type casts (as suggested by Peter Schuller).
- Exposed exceptions as attributes of the connection object.
- Exposed connection as attribute of the cursor object.
- Cursors now support the iteration protocol.
- Added new method to get parameter settings.
- Added customizable row_factory as suggested by Simon Pamies.
- Separated between mandatory and additional type objects.
- Added keyword args to insert, update and delete methods.
- Added exception handling for direct copy.
- Release the GIL while making a connection
(as suggested by Peter Schuller).
- If available, use decimal.Decimal for numeric types.
- Allow DB wrapper to be used with DB-API 2 connections
(as suggested by Chris Hilton).
- Made private attributes of DB wrapper accessible.
- Dropped dependence on mx.DateTime module.
- Support for PQescapeStringConn() and PQescapeByteaConn();
these are now also used by the internal _quote() functions.
- Added 'int8' to INTEGER types. New SMALLINT type.
- Added a way to find the number of rows affected by a query()
with the classic pg module by returning it as a string.
For single inserts, query() still returns the oid as an integer.
The pgdb module already provides the "rowcount" cursor attribute
for the same purpose.
- Improved getnotify() by calling PQconsumeInput() instead of
submitting an empty command.
- Removed compatibility code for old OID munging style.
- The insert() and update() methods now use the "returning" clause
if possible to get all changed values, and they also check in advance
whether a subsequent select is possible, so that ongoing transactions
won't break if there is no select privilege.
- Added "protocol_version" and "server_version" attributes.
- Revived the "user" attribute.
- The pg module now works correctly with composite primary keys;
these are represented as frozensets.
- Removed the undocumented and actually unnecessary "view" parameter
from the get() method.
- get() raises a nicer ProgrammingError instead of a KeyError
if no primary key was found.
- delete() now also works based on the primary key if no oid available
and returns whether the row existed or not.
Mostly bug fixes from 3.8.
- Use string methods instead of deprecated string functions.
- Only use SQL-standard way of escaping quotes.
- Added the functions escape_string() and escape/unescape_bytea()
(as suggested by Charlie Dyson and Kavous Bojnourdi a long time ago).
- Reverted code in clear() method that set date to current.
- Added code for backwards compatibility in OID munging code.
- Reorder attnames tests so that "interval" is checked for before "int."
- If caller supplies key dictionary, make sure that all has a namespace.
- Installed new favicon.ico from Matthew Sporleder <mspo@mspo.com>
- Replaced snprintf by PyOS_snprintf.
- Removed NO_SNPRINTF switch which is not needed any longer
- Clean up some variable names and namespace
- Add get_relations() method to get any type of relation
- Rewrite get_tables() to use get_relations()
- Use new method in get_attnames method to get attributes of views as well
- Add Binary type
- Number of rows is now -1 after executing no-result statements
- Fix some number handling
- Non-simple types do not raise an error any more
- Improvements to documentation framework
- Take into account that nowadays not every table must have an oid column
- Simplification and improvement of the inserttable() function
- Fix up unit tests
- The usual assortment of minor fixes and enhancements
Important changes from PyGreSQL 3.6.2 to PyGreSQL 3.7
- Fixes to quoting function.
- Use Python datetime if mxDatetime is not available.
- Add checks for valid database connection to methods.
- Improved namespace support, handle search_path correctly.
- Removed old dust and unnessesary imports, added docstrings.
- Internal sql statements as one-liners, smoothed out ugly code.
- Major improvements in classic pg module.
Most important change was serious bug in 3.5 that did not allow DB-API 2.0
version to work without a manual change.
Other changes:
- Better DB-API 2.0 compliance
- Exception hierarchy moved into C module and made available to both APIs
- Fix error in update method that caused false exceptions
- Moved to standard exception hierarchy in classic API
- Added new method to get transaction state
- Use proper Python constants where appropriate
- Use Python versions of strtol, etc. Allows WIN32 build
- Bug fixes and cleanups
this package build standalone. py-postgresql uses it's own version
numbering and really doesn't have much to do with the rest of the
postgresql packages.
adds a few minor features and makes a few speedups in the code, plus:
- Fix some DB-API quoting problems (niall.smart@ebeon.com)
- Moved development into PostgreSQL development tree.