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

Last change on this file since 900 was 900, checked in by cito, 3 years ago

Allow query_formatted() to be used without parameters

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