source: trunk/docs/contents/changelog.rst @ 796

Last change on this file since 796 was 796, checked in by cito, 4 years ago

Enrich type_code strings in the DB API 2

The type codes now carry e.g. the information whether a type is a record.
This allows to provide a RECORD type object that compares equal to all
kinds of records, similar to the already existing ARRAY type object.

  • Property svn:keywords set to Author Date Id Revision
File size: 21.0 KB
4Version 5.0
6- This version now runs on both Python 2 and Python 3.
7- The supported versions are Python 2.6 to 2.7, and 3.3 to 3.5.
8- PostgreSQL is supported in all versions from 9.0 to 9.5.
9- Changes in the DB-API 2 module (pgdb):
10  - The DB-API 2 module now always returns result rows as named tuples
11    instead of simply lists as before. The documentation explains how
12    you can restore the old behavior or use custom row objects instead.
13  - The names of the various classes used by the classic and DB-API 2
14    modules have been renamed to become simpler, more intuitive and in
15    line with the names used in the DB-API 2 documentation.
16    Since the API provides only objects of these types through constructor
17    functions, this should not cause any incompatibilities.
18  - The DB-API 2 module now supports the callproc() cursor method. Note
19    that output parameters are currently not replaced in the return value.
20  - The DB-API 2 module now supports copy operations between data streams
21    on the client and database tables via the COPY command of PostgreSQL.
22    The cursor method copy_from() can be used to copy data from the database
23    to the client, and the cursor method copy_to() can be used to copy data
24    from the client to the database.
25  - The 7-tuples returned by the description attribute of a pgdb cursor
26    are now named tuples, i.e. their elements can be also accessed by name.
27    The column names and types can now also be requested through the
28    colnames and coltypes attributes, which are not part of DB-API 2 though.
29    The type_code provided by the description attribute is still equal to
30    the PostgreSQL internal type name, but now carries some more information
31    in additional attributes. The size, precision and scale information that
32    is part of the description is now properly set for numeric types.
33  - If you pass a Python list as one of the parameters to a DB-API 2 cursor,
34    it is now automatically bound using an ARRAY constructor. If you pass a
35    Python tuple, it is bound using a ROW constructor. This is useful for
36    passing records as well as making use of the IN syntax.
37  - Inversely, when a fetch method of a DB-API 2 cursor returns a PostgreSQL
38    array, it is passed to Python as a list, and when it returns a PostgreSQL
39    composite type, it is passed to Python as a named tuple. PyGreSQL uses
40    a new fast built-in parser to achieve this. Anonymous composite types are
41    also supported, but yield only an ordinary tuple containing text strings.
42- Changes in the classic PyGreSQL module (pg):
43  - The classic interface got two new methods get_as_list() and get_as_dict()
44    returning a database table as a Python list or dict. The amount of data
45    returned can be controlled with various parameters.
46  - A method upsert() has been added to the DB wrapper class that utilitses
47    the "upsert" feature that is new in PostgreSQL 9.5. The new method nicely
48    complements the existing get/insert/update/delete() methods.
49  - When using insert/update/upsert(), you can now pass PostgreSQL arrays as
50    lists and PostgreSQL records as tuples in the classic module.
51  - Conversely, when the query method returns a PostgreSQL array, it is passed
52    to Python as a list. PostgreSQL records are converted to named tuples as
53    well, but only if you use one of the get/insert/update/delete() methods.
54    PyGreSQL uses a new fast built-in parser to achieve this.
55  - The pkey() method of the classic interface now returns tuples instead
56    of frozenset. The order of the tuples is like in the primary key index.
57  - Like the DB-API 2 module, the classic module now also returns bytea columns
58    fetched from the database as byte strings, so you don't need to call
59    unescape_bytea() any more.
60  - A method set_jsondecode() has been added for changing or removing the
61    function that automatically decodes JSON data coming from the database.
62    By default, decoding JSON is now enabled and uses the decoder function
63    in the standard library with its default parameters.
64  - The table name that is affixed to the name of the OID column returned
65    by the get() method of the classic interface will not automatically
66    be fully qualified any more. This reduces overhead from the interface,
67    but it means you must always write the table name in the same way when
68    you call the methods using it and you are using tables with OIDs.
69    Also, OIDs are now only used when access via primary key is not possible.
70    Note that OIDs are considered deprecated anyway, and they are not created
71    by default any more in PostgreSQL 8.1 and later.
72  - The internal caching and automatic quoting of class names in the classic
73    interface has been simplified and improved, it should now perform better
74    and use less memory. Also, overhead for quoting values in the DB wrapper
75    methods has been reduced and security has been improved by passing the
76    values to libpq separately as parameters instead of inline.
77  - It is now possible to use regular type names instead of the simpler
78    type names that are used by default in PyGreSQL, without breaking any
79    of the mechanisms for quoting and typecasting, which rely on the type
80    information. This is achieved while maintaining simplicity and backward
81    compatibility by augmenting the type name string objects with all the
82    necessary information under the cover. To switch regular type names on
83    or off (this is the default), call the DB wrapper method use_regtypes().
84  - The methods for adapting and typecasting values pertaining to PostgreSQL
85    types have been refactored and swapped out to separate classes.
86- Changes concerning both modules:
87  - PyGreSQL now supports the JSON and JSONB data types, converting such
88    columns automatically to and from Python objects. If you want to insert
89    Python objects as JSON data using DB-API 2, you should wrap them in the
90    new Json() type constructor as a hint to PyGreSQL.
91  - Fast parsers for the input and output syntax for PostgreSQL arrays and
92    composite types have been added to the C module. Note that you can also
93    use multi-dimensional arrays with PyGreSQL.
94  - The tty parameter and attribute of database connections has been
95    removed since it is not supported any more since PostgreSQL 7.4.
97Version 4.2 (2016-01-21)
99- The supported Python versions are 2.4 to 2.7.
100- PostgreSQL is supported in all versions from 8.3 to 9.5.
101- Set a better default for the user option "escaping-funcs".
102- Force build to compile with no errors.
103- New methods get_parameters() and set_parameters() in the classic interface
104  which can be used to get or set run-time parameters.
105- New method truncate() in the classic interface that can be used to quickly
106  empty a table or a set of tables.
107- Fix decimal point handling.
108- Add option to return boolean values as bool objects.
109- Add option to return money values as string.
110- get_tables() does not list information schema tables any more.
111- Fix notification handler (Thanks Patrick TJ McPhee).
112- Fix a small issue with large objects.
113- Minor improvements of the NotificationHandler.
114- Converted documentation to Sphinx and added many missing parts.
115- The tutorial files have become a chapter in the documentation.
116- Greatly improved unit testing, tests run with Python 2.4 to 2.7 again.
118Version 4.1.1 (2013-01-08)
120- Add NotificationHandler class and method.  Replaces need for pgnotify.
121- Sharpen test for inserting current_timestamp.
122- Add more quote tests.  False and 0 should evaluate to NULL.
123- More tests - Any number other than 0 is True.
124- Do not use positional parameters internally.
125  This restores backward compatibility with version 4.0.
126- Add methods for changing the decimal point.
128Version 4.1 (2013-01-01)
130- Dropped support for Python below 2.5 and PostgreSQL below 8.3.
131- Added support for Python up to 2.7 and PostgreSQL up to 9.2.
132- Particularly, support PQescapeLiteral() and PQescapeIdentifier().
133- The query method of the classic API now supports positional parameters.
134  This an effective way to pass arbitrary or unknown data without worrying
135  about SQL injection or syntax errors (contribution by Patrick TJ McPhee).
136- The classic API now supports a method namedresult() in addition to
137  getresult() and dictresult(), which returns the rows of the result
138  as named tuples if these are supported (Python 2.6 or higher).
139- The classic API has got the new methods begin(), commit(), rollback(),
140  savepoint() and release() for handling transactions.
141- Both classic and DBAPI 2 connections can now be used as context
142  managers for encapsulating transactions.
143- The execute() and executemany() methods now return the cursor object,
144  so you can now write statements like "for row in cursor.execute(...)"
145  (as suggested by Adam Frederick).
146- Binary objects are now automatically escaped and unescaped.
147- Bug in money quoting fixed.  Amounts of $0.00 handled correctly.
148- Proper handling of date and time objects as input.
149- Proper handling of floats with 'nan' or 'inf' values as input.
150- Fixed the set_decimal() function.
151- All DatabaseError instances now have a sqlstate attribute.
152- The getnotify() method can now also return payload strings (#15).
153- Better support for notice processing with the new methods
154  set_notice_receiver() and get_notice_receiver()
155  (as suggested by Michael Filonenko, see #37).
156- Open transactions are rolled back when pgdb connections are closed
157  (as suggested by Peter Harris, see #46).
158- Connections and cursors can now be used with the "with" statement
159  (as suggested by Peter Harris, see #46).
160- New method use_regtypes() that can be called to let getattnames()
161  return regular type names instead of the simplified classic types (#44).
163Version 4.0 (2009-01-01)
165- Dropped support for Python below 2.3 and PostgreSQL below 7.4.
166- Improved performance of fetchall() for large result sets
167  by speeding up the type casts (as suggested by Peter Schuller).
168- Exposed exceptions as attributes of the connection object.
169- Exposed connection as attribute of the cursor object.
170- Cursors now support the iteration protocol.
171- Added new method to get parameter settings.
172- Added customizable row_factory as suggested by Simon Pamies.
173- Separated between mandatory and additional type objects.
174- Added keyword args to insert, update and delete methods.
175- Added exception handling for direct copy.
176- Start transactions only when necessary, not after every commit().
177- Release the GIL while making a connection
178  (as suggested by Peter Schuller).
179- If available, use decimal.Decimal for numeric types.
180- Allow DB wrapper to be used with DB-API 2 connections
181  (as suggested by Chris Hilton).
182- Made private attributes of DB wrapper accessible.
183- Dropped dependence on mx.DateTime module.
184- Support for PQescapeStringConn() and PQescapeByteaConn();
185  these are now also used by the internal _quote() functions.
186- Added 'int8' to INTEGER types. New SMALLINT type.
187- Added a way to find the number of rows affected by a query()
188  with the classic pg module by returning it as a string.
189  For single inserts, query() still returns the oid as an integer.
190  The pgdb module already provides the "rowcount" cursor attribute
191  for the same purpose.
192- Improved getnotify() by calling PQconsumeInput() instead of
193  submitting an empty command.
194- Removed compatibility code for old OID munging style.
195- The insert() and update() methods now use the "returning" clause
196  if possible to get all changed values, and they also check in advance
197  whether a subsequent select is possible, so that ongoing transactions
198  won't break if there is no select privilege.
199- Added "protocol_version" and "server_version" attributes.
200- Revived the "user" attribute.
201- The pg module now works correctly with composite primary keys;
202  these are represented as frozensets.
203- Removed the undocumented and actually unnecessary "view" parameter
204  from the get() method.
205- get() raises a nicer ProgrammingError instead of a KeyError
206  if no primary key was found.
207- delete() now also works based on the primary key if no oid available
208  and returns whether the row existed or not.
210Version 3.8.1 (2006-06-05)
212- Use string methods instead of deprecated string functions.
213- Only use SQL-standard way of escaping quotes.
214- Added the functions escape_string() and escape/unescape_bytea()
215  (as suggested by Charlie Dyson and Kavous Bojnourdi a long time ago).
216- Reverted code in clear() method that set date to current.
217- Added code for backwards compatibility in OID munging code.
218- Reorder attnames tests so that "interval" is checked for before "int."
219- If caller supplies key dictionary, make sure that all has a namespace.
221Version 3.8 (2006-02-17)
223- Installed new favicon.ico from Matthew Sporleder <>
224- Replaced snprintf by PyOS_snprintf.
225- Removed NO_SNPRINTF switch which is not needed any longer
226- Clean up some variable names and namespace
227- Add get_relations() method to get any type of relation
228- Rewrite get_tables() to use get_relations()
229- Use new method in get_attnames method to get attributes of views as well
230- Add Binary type
231- Number of rows is now -1 after executing no-result statements
232- Fix some number handling
233- Non-simple types do not raise an error any more
234- Improvements to documentation framework
235- Take into account that nowadays not every table must have an oid column
236- Simplification and improvement of the inserttable() function
237- Fix up unit tests
238- The usual assortment of minor fixes and enhancements
240Version 3.7 (2005-09-07)
242Improvement of pgdb module:
244- Use Python standard `datetime` if `mxDateTime` is not available
246Major improvements and clean-up in classic pg module:
248- All members of the underlying connection directly available in `DB`
249- Fixes to quoting function
250- Add checks for valid database connection to methods
251- Improved namespace support, handle `search_path` correctly
252- Removed old dust and unnessesary imports, added docstrings
253- Internal sql statements as one-liners, smoothed out ugly code
255Version 3.6.2 (2005-02-23)
257- Further fixes to namespace handling
259Version 3.6.1 (2005-01-11)
261- Fixes to namespace handling
263Version 3.6 (2004-12-17)
265- Better DB-API 2.0 compliance
266- Exception hierarchy moved into C module and made available to both APIs
267- Fix error in update method that caused false exceptions
268- Moved to standard exception hierarchy in classic API
269- Added new method to get transaction state
270- Use proper Python constants where appropriate
271- Use Python versions of strtol, etc. Allows Win32 build.
272- Bug fixes and cleanups
274Version 3.5 (2004-08-29)
276Fixes and enhancements:
278- Add interval to list of data types
279- fix up method wrapping especially close()
280- retry pkeys once if table missing in case it was just added
281- wrap query method separately to handle debug better
282- use isinstance instead of type
283- fix free/PQfreemem issue - finally
284- miscellaneous cleanups and formatting
286Version 3.4 (2004-06-02)
288Some cleanups and fixes.
289This is the first version where PyGreSQL is moved back out of the
290PostgreSQL tree. A lot of the changes mentioned below were actually
291made while in the PostgreSQL tree since their last release.
293- Allow for larger integer returns
294- Return proper strings for true and false
295- Cleanup convenience method creation
296- Enhance debugging method
297- Add reopen method
298- Allow programs to preload field names for speedup
299- Move OID handling so that it returns long instead of int
300- Miscellaneous cleanups and formatting
302Version 3.3 (2001-12-03)
304A few cleanups.  Mostly there was some confusion about the latest version
305and so I am bumping the number to keep it straight.
307- Added NUMERICOID to list of returned types. This fixes a bug when
308  returning aggregates in the latest version of PostgreSQL.
310Version 3.2 (2001-06-20)
312Note that there are very few changes to PyGreSQL between 3.1 and 3.2.
313The main reason for the release is the move into the PostgreSQL
314development tree.  Even the WIN32 changes are pretty minor.
316- Add Win32 support (
317- Fix some DB-API quoting problems (
318- Moved development into PostgreSQL development tree.
320Version 3.1 (2000-11-06)
322- Fix some quoting functions.  In particular handle NULLs better.
323- Use a method to add primary key information rather than direct
324  manipulation of the class structures
325- Break decimal out in `_quote` (in and treat it as float
326- Treat timestamp like date for quoting purposes
327- Remove a redundant SELECT from the `get` method speeding it,
328  and `insert` (since it calls `get`) up a little.
329- Add test for BOOL type in typecast method to `pgdbTypeCache` class
330  (
331- Fix to send port as integer to lower level function
332  (
333- Change to speed up some operations
334- Allow updates on tables with no primary keys
336Version 3.0 (2000-05-30)
338- Remove strlen() call from pglarge_write() and get size from object
339  (
340- Add a little more error checking to the quote function in the wrapper
341- Add extra checking in `_quote` function
342- Wrap query in for debugging
343- Add DB-API 2.0 support to pgmodule.c (
344- Add DB-API 2.0 wrapper (
345- Correct keyword clash (temp) in tutorial
346- Clean up layout of tutorial
347- Return NULL values as None (
348  (WARNING: This will cause backwards compatibility issues)
349- Change None to NULL in insert and update
350- Change hash-bang lines to use /usr/bin/env
351- Clearing date should be blank (NULL) not TODAY
352- Quote backslashes in strings in `_quote` (brian@CSUA.Berkeley.EDU)
353- Expanded and clarified build instructions (
354- Make code thread safe (
355- Add README.distutils ( &
356- Many fixes and increased DB-API compliance by,
357, and others to get the final
358  version ready to release.
360Version 2.4 (1999-06-15)
362- Insert returns None if the user doesn't have select permissions
363  on the table.  It can (and does) happen that one has insert but
364  not select permissions on a table.
365- Added ntuples() method to query object (
366- Corrected a bug related to getresult() and the money type
367- Corrected a bug related to negative money amounts
368- Allow update based on primary key if munged oid not available and
369  table has a primary key
370- Add many __doc__ strings (
371- Get method works with views if key specified
373Version 2.3 (1999-04-17)
375- returns "localhost" when connected to Unix socket
376  (
377- Use `PyArg_ParseTupleAndKeywords` in connect() (
378- fixes and cleanups (
379- Fixed memory leak in dictresult() (
380- Deprecated - functionality now in
381- More cleanups to the tutorial
382- Added fileno() method - (Mikhail Terekhov)
383- added money type to quoting function
384- Compiles cleanly with more warnings turned on
385- Returns PostgreSQL error message on error
386- Init accepts keywords (Jarkko Torppa)
387- Convenience functions can be overridden (Jarkko Torppa)
388- added close() method
390Version 2.2 (1998-12-21)
392- Added user and password support thanks to Ng Pheng Siong (
393- Insert queries return the inserted oid
394- Add new `pg` wrapper (C module renamed to _pg)
395- Wrapped database connection in a class
396- Cleaned up some of the tutorial.  (More work needed.)
397- Added `version` and `__version__`.
398  Thanks to for the suggestion.
400Version 2.1 (1998-03-07)
402- return fields as proper Python objects for field type
403- Cleaned up
404- Added dictresult method
406Version 2.0  (1997-12-23)
408- Updated code for PostgreSQL 6.2.1 and Python 1.5
409- Reformatted code and converted to use full ANSI style prototypes
410- Changed name to PyGreSQL (from PyGres95)
411- Changed order of arguments to connect function
412- Created new type `pgqueryobject` and moved certain methods to it
413- Added a print function for pgqueryobject
414- Various code changes - mostly stylistic
416Version 1.0b (1995-11-04)
418- Keyword support for connect function moved from library file to C code
419  and taken away from library
420- Rewrote documentation
421- Bug fix in connect function
422- Enhancements in large objects interface methods
424Version 1.0a (1995-10-30)
426A limited release.
428- Module adapted to standard Python syntax
429- Keyword support for connect function in library file
430- Rewrote default parameters interface (internal use of strings)
431- Fixed minor bugs in module interface
432- Redefinition of error messages
434Version 0.9b (1995-10-10)
436The first public release.
438- Large objects implementation
439- Many bug fixes, enhancements, ...
441Version 0.1a (1995-10-07)
443- Basic libpq functions (SQL access)
Note: See TracBrowser for help on using the repository browser.