Re: autocommit and Django

From: Federico Di Gregorio <federico(dot)digregorio(at)dndg(dot)it>
To: Jacob Kaplan-Moss <jacob(at)jacobian(dot)org>
Cc: psycopg(at)postgresql(dot)org
Subject: Re: autocommit and Django
Date: 2011-06-22 21:47:55
Message-ID: 4E02630B.4010906@dndg.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 #(at)§%£$! 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 "#(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(dot)digregorio(at)dndg(dot)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

In response to

Responses

Browse psycopg by date

  From Date Subject
Next Message Jacob Kaplan-Moss 2011-06-22 21:59:03 Re: autocommit and Django
Previous Message Jacob Kaplan-Moss 2011-06-22 20:00:29 Re: autocommit and Django