On Fri, 2008-09-19 at 23:47 -0700, Richard Davies wrote: > Hi Jacob, > > I agree that this is documented behavior for PostgreSQL > _transactions_. > > The reason that I think it's a bug is that I shouldn't be in a > transaction at all - as I understand > http://docs.djangoproject.com/en/dev/topics/db/transactions/ > , the default behaviour should be auto-commit in which each individual > change is committed independently and individually, and there is no > transaction taking place.
That documentation says it is similar to auto-commit. It doesn't say it actually is auto-commit. There are explicit transaction commits in the code (grep for commit_unless_managed()). > This is what I see from MySQL InnoDB. > > My problem is that I can't get this auto-commit behavior from > PostgreSQL with Django - either in the default mode or even when I > explicitly use TransactionMiddleware with the @transaction.autocommit > decorator or set DISABLE_TRANSACTION_MANAGEMENT to True. > > > My suggestion is that changing the psycopg isolation level to zero (as > per ticket 3460) will give true auto-commit behaviour for PostgreSQL, > since otherwise psycopg wraps the Django SQL in a transaction block. Whilst it's true that this would give auto-commit behaviour, there's a valid alternate side to this that doesn't seem to be addressed: whether that's actually a good idea or not. One reason not to do this is that it simply isn't standard behaviour for Python database adaptors (they must be in non-autocommit mode initially). So there's a principle of least-surprise thing going on. As I mentioned to Collin at the code sprint in Portland, I think it'd be a good idea to make sure we expose the ability to turn on auto-commit, but I don't really like making it the default. In any case, providing the ability that's can be controlled via, for example, a setting is certainly the first step here. That's pretty independent of the whatever the default might end up being. That's really the improvement needed to #3460 at the moment -- separating adding functionality from changing the default. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" 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-developers?hl=en -~----------~----~----~----~------~----~------~--~---
