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

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

Support the hstore data type

Added adaptation and typecasting of the hstore type as Python dictionaries.
For the typecasting, a fast parser has been added to the C extension.

  • Property svn:keywords set to Author Date Id Revision
File size: 23.0 KB
Line 
1ChangeLog
2=========
3
4Version 5.0
5-----------
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 supports the "hstore" data type, converting such columns
108      automatically to and from Python dictionaries.  If you want to insert
109      Python objects as JSON data using DB-API 2, you should wrap them in the
110      new HStore() type constructor as a hint to PyGreSQL.
111    - PyGreSQL now supports the "json" and "jsonb" data types, converting such
112      columns automatically to and from Python objects. If you want to insert
113      Python objects as JSON data using DB-API 2, you should wrap them in the
114      new Json() type constructor as a hint to PyGreSQL.
115    - A new type helper Literal() for inserting parameters literally as SQL
116      has been added.  This is useful for table names, for instance.
117    - Fast parsers cast_array(), cast_record() and cast_hstore for the input
118      and output syntax for PostgreSQL arrays, composite types and the hstore
119      type have been added to the C extension module. The array parser also
120      allows using multi-dimensional arrays with PyGreSQL.
121    - The tty parameter and attribute of database connections has been
122      removed since it is not supported any more since PostgreSQL 7.4.
123
124Version 4.2 (2016-01-21)
125------------------------
126- The supported Python versions are 2.4 to 2.7.
127- PostgreSQL is supported in all versions from 8.3 to 9.5.
128- Set a better default for the user option "escaping-funcs".
129- Force build to compile with no errors.
130- New methods get_parameters() and set_parameters() in the classic interface
131  which can be used to get or set run-time parameters.
132- New method truncate() in the classic interface that can be used to quickly
133  empty a table or a set of tables.
134- Fix decimal point handling.
135- Add option to return boolean values as bool objects.
136- Add option to return money values as string.
137- get_tables() does not list information schema tables any more.
138- Fix notification handler (Thanks Patrick TJ McPhee).
139- Fix a small issue with large objects.
140- Minor improvements of the NotificationHandler.
141- Converted documentation to Sphinx and added many missing parts.
142- The tutorial files have become a chapter in the documentation.
143- Greatly improved unit testing, tests run with Python 2.4 to 2.7 again.
144
145Version 4.1.1 (2013-01-08)
146--------------------------
147- Add NotificationHandler class and method.  Replaces need for pgnotify.
148- Sharpen test for inserting current_timestamp.
149- Add more quote tests.  False and 0 should evaluate to NULL.
150- More tests - Any number other than 0 is True.
151- Do not use positional parameters internally.
152  This restores backward compatibility with version 4.0.
153- Add methods for changing the decimal point.
154
155Version 4.1 (2013-01-01)
156------------------------
157- Dropped support for Python below 2.5 and PostgreSQL below 8.3.
158- Added support for Python up to 2.7 and PostgreSQL up to 9.2.
159- Particularly, support PQescapeLiteral() and PQescapeIdentifier().
160- The query method of the classic API now supports positional parameters.
161  This an effective way to pass arbitrary or unknown data without worrying
162  about SQL injection or syntax errors (contribution by Patrick TJ McPhee).
163- The classic API now supports a method namedresult() in addition to
164  getresult() and dictresult(), which returns the rows of the result
165  as named tuples if these are supported (Python 2.6 or higher).
166- The classic API has got the new methods begin(), commit(), rollback(),
167  savepoint() and release() for handling transactions.
168- Both classic and DBAPI 2 connections can now be used as context
169  managers for encapsulating transactions.
170- The execute() and executemany() methods now return the cursor object,
171  so you can now write statements like "for row in cursor.execute(...)"
172  (as suggested by Adam Frederick).
173- Binary objects are now automatically escaped and unescaped.
174- Bug in money quoting fixed.  Amounts of $0.00 handled correctly.
175- Proper handling of date and time objects as input.
176- Proper handling of floats with 'nan' or 'inf' values as input.
177- Fixed the set_decimal() function.
178- All DatabaseError instances now have a sqlstate attribute.
179- The getnotify() method can now also return payload strings (#15).
180- Better support for notice processing with the new methods
181  set_notice_receiver() and get_notice_receiver()
182  (as suggested by Michael Filonenko, see #37).
183- Open transactions are rolled back when pgdb connections are closed
184  (as suggested by Peter Harris, see #46).
185- Connections and cursors can now be used with the "with" statement
186  (as suggested by Peter Harris, see #46).
187- New method use_regtypes() that can be called to let getattnames()
188  return regular type names instead of the simplified classic types (#44).
189
190Version 4.0 (2009-01-01)
191------------------------
192- Dropped support for Python below 2.3 and PostgreSQL below 7.4.
193- Improved performance of fetchall() for large result sets
194  by speeding up the type casts (as suggested by Peter Schuller).
195- Exposed exceptions as attributes of the connection object.
196- Exposed connection as attribute of the cursor object.
197- Cursors now support the iteration protocol.
198- Added new method to get parameter settings.
199- Added customizable row_factory as suggested by Simon Pamies.
200- Separated between mandatory and additional type objects.
201- Added keyword args to insert, update and delete methods.
202- Added exception handling for direct copy.
203- Start transactions only when necessary, not after every commit().
204- Release the GIL while making a connection
205  (as suggested by Peter Schuller).
206- If available, use decimal.Decimal for numeric types.
207- Allow DB wrapper to be used with DB-API 2 connections
208  (as suggested by Chris Hilton).
209- Made private attributes of DB wrapper accessible.
210- Dropped dependence on mx.DateTime module.
211- Support for PQescapeStringConn() and PQescapeByteaConn();
212  these are now also used by the internal _quote() functions.
213- Added 'int8' to INTEGER types. New SMALLINT type.
214- Added a way to find the number of rows affected by a query()
215  with the classic pg module by returning it as a string.
216  For single inserts, query() still returns the oid as an integer.
217  The pgdb module already provides the "rowcount" cursor attribute
218  for the same purpose.
219- Improved getnotify() by calling PQconsumeInput() instead of
220  submitting an empty command.
221- Removed compatibility code for old OID munging style.
222- The insert() and update() methods now use the "returning" clause
223  if possible to get all changed values, and they also check in advance
224  whether a subsequent select is possible, so that ongoing transactions
225  won't break if there is no select privilege.
226- Added "protocol_version" and "server_version" attributes.
227- Revived the "user" attribute.
228- The pg module now works correctly with composite primary keys;
229  these are represented as frozensets.
230- Removed the undocumented and actually unnecessary "view" parameter
231  from the get() method.
232- get() raises a nicer ProgrammingError instead of a KeyError
233  if no primary key was found.
234- delete() now also works based on the primary key if no oid available
235  and returns whether the row existed or not.
236
237Version 3.8.1 (2006-06-05)
238--------------------------
239- Use string methods instead of deprecated string functions.
240- Only use SQL-standard way of escaping quotes.
241- Added the functions escape_string() and escape/unescape_bytea()
242  (as suggested by Charlie Dyson and Kavous Bojnourdi a long time ago).
243- Reverted code in clear() method that set date to current.
244- Added code for backwards compatibility in OID munging code.
245- Reorder attnames tests so that "interval" is checked for before "int."
246- If caller supplies key dictionary, make sure that all has a namespace.
247
248Version 3.8 (2006-02-17)
249------------------------
250- Installed new favicon.ico from Matthew Sporleder <mspo@mspo.com>
251- Replaced snprintf by PyOS_snprintf.
252- Removed NO_SNPRINTF switch which is not needed any longer
253- Clean up some variable names and namespace
254- Add get_relations() method to get any type of relation
255- Rewrite get_tables() to use get_relations()
256- Use new method in get_attnames method to get attributes of views as well
257- Add Binary type
258- Number of rows is now -1 after executing no-result statements
259- Fix some number handling
260- Non-simple types do not raise an error any more
261- Improvements to documentation framework
262- Take into account that nowadays not every table must have an oid column
263- Simplification and improvement of the inserttable() function
264- Fix up unit tests
265- The usual assortment of minor fixes and enhancements
266
267Version 3.7 (2005-09-07)
268------------------------
269Improvement of pgdb module:
270
271- Use Python standard `datetime` if `mxDateTime` is not available
272
273Major improvements and clean-up in classic pg module:
274
275- All members of the underlying connection directly available in `DB`
276- Fixes to quoting function
277- Add checks for valid database connection to methods
278- Improved namespace support, handle `search_path` correctly
279- Removed old dust and unnessesary imports, added docstrings
280- Internal sql statements as one-liners, smoothed out ugly code
281
282Version 3.6.2 (2005-02-23)
283--------------------------
284- Further fixes to namespace handling
285
286Version 3.6.1 (2005-01-11)
287--------------------------
288- Fixes to namespace handling
289
290Version 3.6 (2004-12-17)
291------------------------
292- Better DB-API 2.0 compliance
293- Exception hierarchy moved into C module and made available to both APIs
294- Fix error in update method that caused false exceptions
295- Moved to standard exception hierarchy in classic API
296- Added new method to get transaction state
297- Use proper Python constants where appropriate
298- Use Python versions of strtol, etc. Allows Win32 build.
299- Bug fixes and cleanups
300
301Version 3.5 (2004-08-29)
302------------------------
303Fixes and enhancements:
304
305- Add interval to list of data types
306- fix up method wrapping especially close()
307- retry pkeys once if table missing in case it was just added
308- wrap query method separately to handle debug better
309- use isinstance instead of type
310- fix free/PQfreemem issue - finally
311- miscellaneous cleanups and formatting
312
313Version 3.4 (2004-06-02)
314------------------------
315Some cleanups and fixes.
316This is the first version where PyGreSQL is moved back out of the
317PostgreSQL tree. A lot of the changes mentioned below were actually
318made while in the PostgreSQL tree since their last release.
319
320- Allow for larger integer returns
321- Return proper strings for true and false
322- Cleanup convenience method creation
323- Enhance debugging method
324- Add reopen method
325- Allow programs to preload field names for speedup
326- Move OID handling so that it returns long instead of int
327- Miscellaneous cleanups and formatting
328
329Version 3.3 (2001-12-03)
330------------------------
331A few cleanups.  Mostly there was some confusion about the latest version
332and so I am bumping the number to keep it straight.
333
334- Added NUMERICOID to list of returned types. This fixes a bug when
335  returning aggregates in the latest version of PostgreSQL.
336
337Version 3.2 (2001-06-20)
338------------------------
339Note that there are very few changes to PyGreSQL between 3.1 and 3.2.
340The main reason for the release is the move into the PostgreSQL
341development tree.  Even the WIN32 changes are pretty minor.
342
343- Add Win32 support (gerhard@bigfoot.de)
344- Fix some DB-API quoting problems (niall.smart@ebeon.com)
345- Moved development into PostgreSQL development tree.
346
347Version 3.1 (2000-11-06)
348------------------------
349- Fix some quoting functions.  In particular handle NULLs better.
350- Use a method to add primary key information rather than direct
351  manipulation of the class structures
352- Break decimal out in `_quote` (in pg.py) and treat it as float
353- Treat timestamp like date for quoting purposes
354- Remove a redundant SELECT from the `get` method speeding it,
355  and `insert` (since it calls `get`) up a little.
356- Add test for BOOL type in typecast method to `pgdbTypeCache` class
357  (tv@beamnet.de)
358- Fix pgdb.py to send port as integer to lower level function
359  (dildog@l0pht.com)
360- Change pg.py to speed up some operations
361- Allow updates on tables with no primary keys
362
363Version 3.0 (2000-05-30)
364------------------------
365- Remove strlen() call from pglarge_write() and get size from object
366  (Richard@Bouska.cz)
367- Add a little more error checking to the quote function in the wrapper
368- Add extra checking in `_quote` function
369- Wrap query in pg.py for debugging
370- Add DB-API 2.0 support to pgmodule.c (andre@via.ecp.fr)
371- Add DB-API 2.0 wrapper pgdb.py (andre@via.ecp.fr)
372- Correct keyword clash (temp) in tutorial
373- Clean up layout of tutorial
374- Return NULL values as None (rlawrence@lastfoot.com)
375  (WARNING: This will cause backwards compatibility issues)
376- Change None to NULL in insert and update
377- Change hash-bang lines to use /usr/bin/env
378- Clearing date should be blank (NULL) not TODAY
379- Quote backslashes in strings in `_quote` (brian@CSUA.Berkeley.EDU)
380- Expanded and clarified build instructions (tbryan@starship.python.net)
381- Make code thread safe (Jerome.Alet@unice.fr)
382- Add README.distutils (mwa@gate.net & jeremy@cnri.reston.va.us)
383- Many fixes and increased DB-API compliance by chifungfan@yahoo.com,
384  tony@printra.net, jeremy@alum.mit.edu and others to get the final
385  version ready to release.
386
387Version 2.4 (1999-06-15)
388------------------------
389- Insert returns None if the user doesn't have select permissions
390  on the table.  It can (and does) happen that one has insert but
391  not select permissions on a table.
392- Added ntuples() method to query object (brit@druid.net)
393- Corrected a bug related to getresult() and the money type
394- Corrected a bug related to negative money amounts
395- Allow update based on primary key if munged oid not available and
396  table has a primary key
397- Add many __doc__ strings (andre@via.ecp.fr)
398- Get method works with views if key specified
399
400Version 2.3 (1999-04-17)
401------------------------
402- connect.host returns "localhost" when connected to Unix socket
403  (torppa@tuhnu.cutery.fi)
404- Use `PyArg_ParseTupleAndKeywords` in connect() (torppa@tuhnu.cutery.fi)
405- fixes and cleanups (torppa@tuhnu.cutery.fi)
406- Fixed memory leak in dictresult() (terekhov@emc.com)
407- Deprecated pgext.py - functionality now in pg.py
408- More cleanups to the tutorial
409- Added fileno() method - terekhov@emc.com (Mikhail Terekhov)
410- added money type to quoting function
411- Compiles cleanly with more warnings turned on
412- Returns PostgreSQL error message on error
413- Init accepts keywords (Jarkko Torppa)
414- Convenience functions can be overridden (Jarkko Torppa)
415- added close() method
416
417Version 2.2 (1998-12-21)
418------------------------
419- Added user and password support thanks to Ng Pheng Siong (ngps@post1.com)
420- Insert queries return the inserted oid
421- Add new `pg` wrapper (C module renamed to _pg)
422- Wrapped database connection in a class
423- Cleaned up some of the tutorial.  (More work needed.)
424- Added `version` and `__version__`.
425  Thanks to thilo@eevolute.com for the suggestion.
426
427Version 2.1 (1998-03-07)
428------------------------
429- return fields as proper Python objects for field type
430- Cleaned up pgext.py
431- Added dictresult method
432
433Version 2.0  (1997-12-23)
434-------------------------
435- Updated code for PostgreSQL 6.2.1 and Python 1.5
436- Reformatted code and converted to use full ANSI style prototypes
437- Changed name to PyGreSQL (from PyGres95)
438- Changed order of arguments to connect function
439- Created new type `pgqueryobject` and moved certain methods to it
440- Added a print function for pgqueryobject
441- Various code changes - mostly stylistic
442
443Version 1.0b (1995-11-04)
444-------------------------
445- Keyword support for connect function moved from library file to C code
446  and taken away from library
447- Rewrote documentation
448- Bug fix in connect function
449- Enhancements in large objects interface methods
450
451Version 1.0a (1995-10-30)
452-------------------------
453A limited release.
454
455- Module adapted to standard Python syntax
456- Keyword support for connect function in library file
457- Rewrote default parameters interface (internal use of strings)
458- Fixed minor bugs in module interface
459- Redefinition of error messages
460
461Version 0.9b (1995-10-10)
462-------------------------
463The first public release.
464
465- Large objects implementation
466- Many bug fixes, enhancements, ...
467
468Version 0.1a (1995-10-07)
469-------------------------
470- Basic libpq functions (SQL access)
Note: See TracBrowser for help on using the repository browser.