psycopg2da: better pattern matching for Retry exceptions; it is now compatible with postgresql 8.0, 8.1 and 8.2 exception messages.

This commit is contained in:
Fabio Tranchitella 2007-03-25 03:39:23 +00:00
parent 2ae0c32031
commit fadd1a6938
2 changed files with 2 additions and 5 deletions

View File

@ -0,0 +1 @@
# empty file

View File

@ -379,11 +379,7 @@ def _handle_psycopg_exception(error):
# PostgreSQL releases - if so, the different messages should be added # PostgreSQL releases - if so, the different messages should be added
# rather than the existing ones changed so this logic works with # rather than the existing ones changed so this logic works with
# different versions. # different versions.
if msg.startswith( if 'could not serialize' in msg or 'deadlock detected' in msg:
'ERROR: could not serialize access due to concurrent update'
):
raise Retry(sys.exc_info())
if msg.startswith('ERROR: deadlock detected'):
raise Retry(sys.exc_info()) raise Retry(sys.exc_info())
raise raise