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

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

Support the uuid data type

This is often useful and also supported by SQLAlchemy

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