OverflowError in pyPgSQL when accessing tables with many rows
Paolo Alexis Falcone
pfalcone at free.net.ph
Fri Jun 27 22:56:31 EDT 2003
Whenever I try to access a table with many rows using PgSQL's
fetchall(), this happens:
>>> from pyPgSQL import PgSQL
>>> db = PgSQL.connect("192.168.0.8:5432:whitegold","dondon","dondon")
>>> PgSQL.NoPostgresCursor = 1
>>> cur = db.cursor()
>>> cur.execute("SELECT * FROM customer")
>>> data = cur.fetchall()
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.2/site-packages/pyPgSQL/PgSQL.py", line 3106,
in fetchall
return self.__fetchManyRows(self._rows_, _list)
File "/usr/lib/python2.2/site-packages/pyPgSQL/PgSQL.py", line 2684,
in __fetchManyRows
_j = self.__fetchOneRow()
File "/usr/lib/python2.2/site-packages/pyPgSQL/PgSQL.py", line 2660,
in __fetchOneRow
_r.getvalue(self._idx_, _i)))
File "/usr/lib/python2.2/site-packages/pyPgSQL/PgSQL.py", line 717,
in typecast
return PgNumeric(value, _p, _s)
File "/usr/lib/python2.2/site-packages/pyPgSQL/PgSQL.py", line 1335,
in __init__
raise OverflowError, "value too large for PgNumeric"
OverflowError: value too large for PgNumeric
The aforementioned table, customer, only has 1023 entries with the
following structure:
CREATE TABLE customer (ccustcode varchar(80), cgroupcode varchar(10),
clastname varchar(80), cfirstname varchar(80), cmi varchar(10),
ccompany varchar(80), caddress1 varchar(80), caddress2 varchar(80),
ccity varchar(80), cprovince varchar(80), czipcode varchar(10), iterms
integer, ycredit_limit numeric, npenalty_rate numeric,
default_routecode varchar(10), lisdirector boolean);
PgSQL's fetchone() fortunately works though, as well as using
fetchall() on tables with few rows. Is there any alternative way of
using PyPgSQL that would not overflow in this situation?
My test system is on Debian Sid with the following python and
postgresql package versions:
ii postgresql 7.3.3-1 Object-relational SQL database,
descended fr
ii postgresql-cli 7.3.3-1 Front-end programs for PostgreSQL
ii postgresql-con 7.3.3-1 Additional facilities for PostgreSQL
ii python2.2 2.2.3-2.1 An interactive high-level
object-oriented la
ii python2.2-egen 2.0.4-1 Date and time handling routines for
Python 2
ii python2.2-egen 2.0.4-1 A collection of new builtins for
Python 2.2
ii python2.2-nume 23.0-5 Numerical (matrix-oriented)
Mathematics for
ii python2.2-nume 23.0-5 Extension modules for Numeric Python
ii python2.2-pgsq 2.3.0-2 A Python DB-API 2.0 interface to
PostgreSQL
--> paolo
Paolo Alexis Falcone
pfalcone at free.net.ph
More information about the Python-list
mailing list