From: SourceForge.net <no...@so...> - 2004-07-09 03:55:09
|
Patches item #987719, was opened at 2004-07-08 23:55 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=316528&aid=987719&group_id=16528 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Ken Lalonde (kenlalonde) Assigned to: Nobody/Anonymous (nobody) Summary: Access to SQLSTATE + memory leak Initial Comment: It would be nice if one had access to the postgresql 5 character "SQLSTATE" error code, to, for example, unambiguously determine if a serialization error happened and the transaction should be re-run. The error code is more precise and future-proof than a substring check on the textual error message. I've attached a patch to the 2.4 version of pgconnection.c. It changes the value of a libpq.OperationalError exception to a tuple: (sqlstate, message), a la OSError. This fix is sufficient, but I lack the pythonic karma to say if it's the best way. I added a missing PQclear() call too. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=316528&aid=987719&group_id=16528 |