PostgreSQL pgdb driver raises "can't rollback" exception
- by David Parunakian
Hello,
for some reason I'm experiencing the Operational Error with "can't rollback" message when I attempt to roll back my transaction in the following context:
try:
cursors[instance].execute("lock revision, app, timeout IN SHARE MODE")
cursors[instance].execute("insert into app (type, active, active_revision, contents, z) values ('session', true, %s, %s, 0) returning id", (cRevision, sessionId))
sAppId = cursors[instance].fetchone()[0]
cursors[instance].execute("insert into revision (app_id, type) values (%s, 'active')", (sAppId,))
cursors[instance].execute("insert into timeout (app_id, last_seen) values (%s, now())", (sAppId,))
connections[instance].commit()
except pgdb.DatabaseError, e:
connections[instance].rollback()
return "{status: 'error', errno:4, errmsg: \"%s\"}"%(str(e).replace('\"', '\\"').replace('\n', '\\n').replace('\r', '\\r'))
The driver in use is PGDB.
What is fundamentally wrong here?