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

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

Use query parameters instead of inline values

The single row methods of the DB wrapper class created queries with inline values
instead of passing them separately as parameters, even though our query method
does have this capability. Using query parameters also spares us a lot of quoting
and escaping that is necessary when passing values inline.

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