On Mon, 2009-04-06 at 07:05 -0700, Anssi Kaariainen wrote:
> 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.

You're correct that this would be more informative. There are a few
other places that need a similar treatment and we'll change all of them
at once. It's a (relatively low-priority) item on my list of things to
do at some point.

Regards,
Malcolm


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to