[Zope-DB] ZPsycopgDA (version 1.0.13) problems
Dieter Maurer
dieter@handshake.de
Mon, 20 Jan 2003 13:20:10 +0100
Dear Michele and Federico,
we are using your ZPsycopgDA (1.0.13) and encountered the following
problems:
* "db.DA.query" catches "psycopg.ProgrammingError" and
checks against "ERROR: Can't serialize access due to concurrent update".
However, our Postgres intallation reports this problem as
"psycopg.IntegrityError".
I suggest to add that in the "except" clause:
except (psycopg.ProgrammingError,psycopg.IntegrityError), perr:
* The code uses "raise sys.exc_type, ...". However, this is
not thread safe. Suggest to use "raise" instead.
* The error handling in "db.DA.query" is inhomogenous (and irrational):
- "InterfaceError" checks for "self.db" which is unnecessary,
because we just used it (therefore it must exist).
- "OperationalError" does not check for "self.db" but wraps
the close/reopen in a redundant "try: ... except: raise".
Suggest to fold and unify handling for "OperationalError" and
"InterfaceError":
except (psycopg.OperationalError, psycopg.InterfaceError), err:
del c; del self.db # close
self.db= self.connect(self.connection) # reopen
return self.query(query_string,max_rows) # retry
* "max_rows==0" is interpreted as to not return results at all.
It seems more consistent with other use of the value "0"
to interpret it as "no restriction"
* I have added error logging to "db.DA.query" such that one can better
understand what goes wrong.
* I have been unable to understand the motivation for the "failure"
use in "db.DA.query".
Besides, we still have a problem not yet understood:
Sometimes, we seem to get empty result sets from Postgres (where we know,
the result set should be non-empty).
We are still investigating this problem.
Kind regards
Dieter