Le 1 févr. 2011 à 15:59, bruno desthuilliers wrote :
> 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.

You probably miss the big picture (ie, several legacy databases, each with 
their own models plus synchronization between them and a central django 
database).

> 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

Actually, I posted because this just doesn't seem to work.
If I try to rollback the transaction, I just get a nice error that I'not within 
a transaction.

I haven't tested savepoints, but transaction rollback and autocommit doesn't 
seem to work here.
I'll probably write a sample project this week to point the issue.

Regards,
Xavier.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to