Error during "SELECT" using psycopg 2.0.2

Nathan <[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
Hi, I'm new to this list.  I've been using psycopg for a few years
now, but have just recently begun experiencing problems with one of my
scripts that I've started using more often than I used to.

I've got a python script (python 2.4.2 on 32-bit linux) that uses
python threads and psycopg (2.0.2) to connect to postgres (8.2.3).
The threads each do a bunch of selects, inserts, updates, and deletes,
and I've started intermittently having crashes with the following
error:

Exception in thread Thread-45:
Traceback (most recent call last):
  File "/usr/lib/python2.4/threading.py", line 442, in __bootstrap
    self.run()
[snip]
OperationalError: ERROR:  SET TRANSACTION ISOLATION LEVEL must be
called before any query

The oddest thing to me is the error occurs on a SELECT statement in the form of:

SELECT col1, col2, col3 from table1 where col1='val1' and col2='val2';

...which seems like the last kind of statement that would trip an error.

Where should I look next to debug this?  As this crash happens
_sometimes_ (maybe 15% of the time), I'm having a hard time
duplicating it (which seems typical for thread-related errors).  I sit
down to debug it when I find it has happened, run the script again so
I can try to isolate the crash but the script successfully completes,
so I have to wait another day for more data to be available to
process!

~ Nathan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.