aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/python/pg.py
Commit message (Collapse)AuthorAge
* remove python module, as its moved to http://www.pygresql.orgMarc G. Fournier2003-08-01
|
* This is a bug in python interface module,Bruce Momjian2003-06-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | postgresql-7.3.3/src/interfaces/python/pg.py. _quote() function fails due to integer overflow if input d is larger than max integer. In the case where the column type is "BIGINT", the input d may very well be larger than max integer while its type, t, is labeled 'int'. The conversion on line 19, return "%d" % int(d), will fail due to "OverflowError: long int too large to convert to int". Please describe a way to repeat the problem. Please try to provide a concise reproducible example, if at all possible: ---------------------------------------------------------------------- [1] create a table with a column type 'BIGINT'. [2] use pg.DB.insert() to insert a value that is larger than max integer If you know how this problem might be fixed, list the solution below: --------------------------------------------------------------------- Just changing the conversion at line 19 of pg.py to long(d) instead of int(d) should fix it. The following is a patch: Chih-Hao Huang
* The quote function should return a string suitable for dropping into aD'Arcy J.M. Cain2003-02-26
| | | | | query string. This fixes a bug where bool types sometimes returned with a string that could not be dropped into a query.
* > There is an ugly little problem with the DB wrapper class.Bruce Momjian2002-12-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > In pg.py the attributes of DB are defined as being the same as > the attributes of the corresponding pgobject "db", using the following ... > The problem is that the attributes of db (which are read only) > are not static (they are actually function calls to PostgreSQL), > especially "status" and "error", but those attributes are copied > and this is done only once when initializing the DB object. > > So, in effect, only the attribute "db.error" of a DB instance > will be updated, but not the attribute "error". Same with "status". > Don't copy the (read only) attributes of the pgobject to the > DB object, but only the methods, and all of them, like this: > > --------------- change in pg.py ------------------ > # Create convience methods, in a way that is still overridable. > for e in self.db.__methods__: > setattr(self, e, getattr(self.db, e)) > ---------------------------------------------------- > > Furthermore, make an addition to the documentation of the > DB wrapper class (i.e. in pygresql-pg-db.html): > After the sentence "All pgobject methods are included in this class also." > add the following sentence "The pgobject read-only attributes can be > accessed py adding the prefix 'db.' to them." Christoph Zwerschke
* Change the pkey method so that the caller can optionally set the dictionaryD'Arcy J.M. Cain2002-11-25
| | | | | | | | | used for the primary key lookup. This will prevent a database lookup for each connection object that gets created. This could be a significant optimization on a busy system. Similarly, the get_attnames method allows for the attributes dictionary to be installed directly.
* Change the debug variable to allow better control by the caller over howD'Arcy J.M. Cain2002-11-25
| | | | | | | | | | | | | debug output is managed. The user can continue to use the current method of passing a formatting string to have a replacement done and output will be sent to the standard output exactly as it did before. In addition they can set it to a file object, sys.stderr for example, and the query string will be printed to it. Thay can also set it to a method (function) and the query string will be passed to that method giving them the maximum flexibility to do whatever they want with the query string. I will be working with the PyGreSQL documentation shortly and at that time will properly document this feature.
* Well, that certainly appeared to be very straight forward. pg.py andBruce Momjian2002-08-15
| | | | | | | | | | | syscat.py scripts were both modified. pg.py uses it to cache a list of pks (which is seemingly does for every db connection) and various attributes. syscat uses it to walk the list of system tables and queries the various attributes from these tables. In both cases, it seemingly makes sense to apply what you've requested. Greg Copeland
* Fix name in comments and add info about this module's place in PyGreSQL.D'Arcy J.M. Cain2002-03-19
|
* The "%d", while syntactically correct, was confusing. Added a space toD'Arcy J.M. Cain2001-11-04
| | | | make it clearer that d was the argument to the format operator.
* Add oid to list of keys cached.D'Arcy J.M. Cain2001-03-03
| | | | Add a test to avoid an exception in certain cases.
* Update to PyGreSQL 3.1:Bruce Momjian2000-11-10
| | | | | | | | | | | | | | | | | | | | | | | | | | Fix some quoting functions. In particular handle NULLs better. Use a method to add primary key information rather than direct manipulation of the class structures. Break decimal out in _quote (in pg.py) and treat it as float. Treat timestamp like date for quoting purposes. Remove a redundant SELECT from the get method speeding it, and insert since it calls get, up a little. Add test for BOOL type in typecast method to pgdbTypeCache class. (tv@beamnet.de) Fix pgdb.py to send port as integer to lower level function (dildog@l0pht.com) Change pg.py to speed up some operations Allow updates on tables with no primary keys. D'Arcy J.M. Cain
* Update for PyGreSQL 3.0, from D'Arcy J.M. CainBruce Momjian2000-10-02
|
* Bring python up to date ...Marc G. Fournier1999-05-19
| | | | From: D'Arcy J.M. Cain <darcy@druid.net>
* Re-add python.Bruce Momjian1999-05-17
|
* Update to PyGreSQL 2.3.Bruce Momjian1999-05-10
|
* Upgrade to Pygress 2.2.Bruce Momjian1998-12-17