pypgsql -- not preserving transactions ?
gerhard.haering at gmx.de
Mon Sep 16 06:44:44 CEST 2002
First, I'd recommend to ask questions like this on the pypgsql-user
mailing list. You'll find the link on http://pypgsql.sf.net/
* Frank Miles <fpm at u.washington.edu> [2002-09-16 03:15 +0000]:
> I've discovered that the 2.0 version of pyPgSQL packaged with Debian/woody
> doesn't preserve transactions (at least with Postgres). For example, if
> a transaction consists of a series of INSERTs, and an error occurs partway
> through the series, a COMMIT at the end of the series will result in the
> INSERTs up to the erroneous one being thrown out (rollback), but unfortunately
> those following the error being committed.
I can't reproduce that behaviour here. What do you do to ignore the
PgSQL.OperationalError? Or is it a different exception that gets thrown?
> In looking at the imported code, there are comments about trying to
> recover from a defective state, with the class variable
> 'inTransaction' being cleared.
> Does any newer version fix this nonsense?
This area of code hasn't changed up to 2.2, IIRC. Could you provide a
test case with a minimal schema, minimal code and the output of your
code. To see which SQL commands pyPgSQL sends, you can simply access
pyconn.conn.toggleShowQuery, where pyconn is your DB-API connection
object. This output would be useful, too. Also, which PostgreSQL server
version are you using?
More information about the Python-list