<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<title></title>
</head>
<body>
Paolo Alexis Falcone wrote:<br>
<blockquote type="cite"
cite="midea170aaf.0306271856.3916b5f@posting.google.com">
<pre wrap="">Whenever I try to access a table with many rows using PgSQL's
fetchall(), this happens:
</pre>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">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()
</pre>
</blockquote>
</blockquote>
</blockquote>
<pre wrap=""><!---->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?</pre>
</blockquote>
Paolo,<br>
<br>
The problem is not the number of rows, but the fact the conversion of a
PostgreSQL numeric to a PgNumeric is failing. This problem has been
fixed in the code in the <a
href="http://sourceforge.net/cvs/?group_id=16528">CVS repository for
the pyPgSQL project</a> on SourceForge. We will also be releaseing a
new version of pyPgSQL within the next couple of weeks.<br>
<br>
<pre class="moz-signature" cols="72">--
___________________________________________________________________________
____ | Billy G. Allie | Domain....: <a
class="moz-txt-link-abbreviated" href="mailto:Bill.Allie@mug.org">Bill.Allie@mug.org</a>
| /| | 7436 Hartwell | MSN.......: <a
class="moz-txt-link-abbreviated" href="mailto:B_G_Allie@email.msn.com">B_G_Allie@email.msn.com</a>
|-/-|----- | Dearborn, MI 48126|
|/ |LLIE | (313) 582-1540 |
</pre>
</body>
</html>