Re: Django, Postgres and recovering from database constraints
On 1 fév, 15:24, Xavier Ordoquy <xordo...@linovia.com> wrote:
> Hi all,
>
> I got a project which sometime outputs database integrity errors (key violates unique constraint).
> It is fine since I'm keeping an events table which may have several creation messages for the same object.
Hmmm... Either I misunderstood you or you have a design problem here.
But anyway:
> Until now, I was just catching the exception and forgot about it.
>
> Today, I'm not sure this is the right way.
> If the exception in itself is correctly processed, I noticed that any database operation behind raises another exception saying that postgresql hates me and won't perform any other operation (current transation is aborted, commands ignored until end of transaction block.).
> I already tried to end the transaction, but django will let me know I'm not within a transaction....
Hu ?
I assume you did read this:
http://docs.djangoproject.com/en/dev/topics/db/transactions
and specially this part:
http://docs.djangoproject.com/en/dev/topics/db/transactions/#handling-exceptions-within-postgresql-transactions
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home