Re: autocommit and Django - Mailing list psycopg

From Federico Di Gregorio
Subject Re: autocommit and Django
Date
Msg-id 4E02630B.4010906@dndg.it
Whole thread Raw
In response to Re: autocommit and Django  (Jacob Kaplan-Moss <jacob@jacobian.org>)
Responses Re: autocommit and Django  (Jacob Kaplan-Moss <jacob@jacobian.org>)
List psycopg
On 22/06/11 22:00, Jacob Kaplan-Moss wrote:
> On Tue, 14 Jun 2011 12:02:26 +0200, Federico Di Gregorio wrote:
>> If we don't want to wait for the #@§%£$! person that wrote the Django
>> code to fix it…
>
> Hi - that's me. Could you do me a favor and in the future just drop me
> a line instead of insulting the entire Django community?

Well, sorry. One should not suppose somebody else having read Asterix
comics and be able to smile while looking at "#@§%£$!". Anyway, nice to
meet you!

> Anyway, though: how would you suggest we fix this? Does the patch
> (https://code.djangoproject.com/attachment/ticket/16250/16250-2.diff)
> look reasonable?

It is just half of the fix. You can't assume that switching to
autocommit will do an implicit ROLLBACK for you. This worked until now
by chance (and because some drivers share the same logic and even some
code) but will break with new drivers or when old drivers decide to
"fix" the switch as we did for psycopg. So, IMHO, the best thing is to
always call .rollback() before switching transaction level.

federico

--
Federico Di Gregorio                         federico.digregorio@dndg.it
Studio Associato Di Nunzio e Di Gregorio                  http://dndg.it
 And anyone who yells "fork" deserves to get one stuck in them.
                                                          -- Dan Winship

psycopg by date:

Previous
From: Jacob Kaplan-Moss
Date:
Subject: Re: autocommit and Django
Next
From: Jacob Kaplan-Moss
Date:
Subject: Re: autocommit and Django