jwp/py-postgresql — Issue #58: "COMMIT PREPARED cannot run inside a transaction block" with 9.1.2
Author: rabaxabel
Created: 2011-12-20 21:56:26+00:00
State: open

After upgrading client and backend from 8.4.9 to 9.1.2 my unchanged application gets always an server error exception.
The error message makes no sense to me, because There is no 2pc in my program.
It happens at the end of a transaction block, starting with:
with db.xact('SERIALIZABLE'):

Source available at
https://www.chaos1.de/svn-public/repos/network-tools/ERDB/trunk/database/erdb_bt_purge.py

---
Traceback (most recent call last):
File "/usr/local/etc/exim/erdb_bt.py", line 851, in
erdb_bt_purge.updateSumOfEvents(db, DEBUG)
File "/usr/local/etc/exim/erdb_bt_purge.py", line 192, in updateSumOfEvents
(myDeletes, myUpdates, myInserts, myIntEnum))
File "/usr/local/lib/python3.2/site-packages/postgresql/driver/pq3.py", line 2085, in __exit__
self.commit()
File "/usr/local/lib/python3.2/site-packages/postgresql/driver/pq3.py", line 2243, in commit
self.database.execute(q)
File "/usr/local/lib/python3.2/site-packages/postgresql/driver/pq3.py", line 2338, in execute
self._pq_complete()
File "/usr/local/lib/python3.2/site-packages/postgresql/driver/pq3.py", line 2629, in _pq_complete
self.typio.raise_error(x.error_message, cause = getattr(x, 'exception', None))
File "/usr/local/lib/python3.2/site-packages/postgresql/driver/pq3.py", line 511, in raise_error
self.raise_server_error(error_message, **kw)
File "/usr/local/lib/python3.2/site-packages/postgresql/driver/pq3.py", line 502, in raise_server_error
raise server_error
postgresql.exceptions.ActiveTransactionError: COMMIT PREPARED cannot run inside a transaction block
CODE: 25001
LOCATION: File 'xact.c', line 2836, in PreventTransactionChain from SERVER
CAUSE: The prepared transaction was not prepared prior to the block's exit.
CONNECTION: [idle]
client_address: 2.3.4.5/32
client_port: 44920
version:
PostgreSQL 9.1.2 on amd64-portbld-freebsd8.2, compiled by cc (GCC) 4.2.1 20070719 [FreeBSD], 64-bit
CONNECTOR: [Host] pq://user@host:5432/database
category: None
DRIVER: postgresql.driver.pq3.Driver
---

Axel