I ran to an problem when playing around with Postgresql deferred
constraint triggers. While deferred constraint triggers themselves are
not too important for Django, the consuming of on-commit DB errors
is.
I will go through the code to show what is happening: The problem is
the function _commit_on_success(), line 235 in file django/db/
transaction.py (using svn trunk). The problem is in the lines
if is_dirty():
commit()
Now, if the commit() doesn't succeed the raised exception will be
silently consumed. Subsequently the
finally:
leave_transaction_management()
will rollback the transaction and raise a
TransactionManagementError("Transaction managed block ended with
pending COMMIT/ROLLBACK")
This is not informative of what has really happened. A proposed fix
would be
if is_dirty():
try:
commit()
except:
rollback()
raise
and we at least get a proper exception back.
Sorry if this post does not belong to this list. I am not really sure
what is happening in the code. The construct except: ... else: is not
clear to me and I can't find the imported connection module. For these
reasons I posted here instead of posting a ticket.
Anssi Kaariainen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---