psycopg2-ctypes icon indicating copy to clipboard operation
psycopg2-ctypes copied to clipboard

Infinite loop when result size exceeds Cursor.itersize

Open lopuhin opened this issue 13 years ago • 0 comments

If the number of results the query returns is greater than Cursor.itersize (currently 2000), the call to cursor.iter never returns. If I make it large, say 100000, the call finishes ok. Traceback:

File "/home/kostia/chtd/netdb_test/netdb_test/pypy-env/src/netdb/netdb/stitcher.py", line 306, in __iter__
    for row in cursor :
File "/home/kostia/chtd/netdb_test/netdb_test/pypy-env/site-packages/psycopg2ct/_impl/cursor.py", line 550, in __iter__
    rows = self.fetchmany(self.itersize)
File "/home/kostia/chtd/netdb_test/netdb_test/pypy-env/site-packages/psycopg2ct/_impl/cursor.py", line 22, in check_closed_
    return func(self, *args, **kwargs)
File "/home/kostia/chtd/netdb_test/netdb_test/pypy-env/site-packages/psycopg2ct/_impl/cursor.py", line 35, in check_no_tuples_
    return func(self, *args, **kwargs)
File "/home/kostia/chtd/netdb_test/netdb_test/pypy-env/site-packages/psycopg2ct/_impl/cursor.py", line 336, in fetchmany
    rows.append(self._build_row(self._rownumber))
File "/home/kostia/chtd/netdb_test/netdb_test/pypy-env/site-packages/psycopg2ct/_impl/cursor.py", line 821, in _build_row
    for i in xrange(n):
KeyboardInterrupt

If the issue is not obvious from this description, I can make a test for it, or try to fix it myself.

lopuhin avatar Sep 21 '12 14:09 lopuhin