Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Postgresql transaction aborts, despite being in autocommit mode
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Richard Davies  
View profile  
 More options Sep 21 2008, 2:32 pm
From: Richard Davies <richard.dav...@elastichosts.com>
Date: Sun, 21 Sep 2008 11:32:25 -0700 (PDT)
Local: Sun, Sep 21 2008 2:32 pm
Subject: Re: Postgresql transaction aborts, despite being in autocommit mode

> 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.

I'm not convinced by the argument of least-surprise. As you said,
there
are explicit commit_unless_managed() calls inside the Django internals
(e.g. inside save() ) - but a Django _user_ (rather than developer)
would
not have read this code before calling save().

So, a Django user who expects Python database adaptors to be
non-autocommit is _already_ being surprised by the fact that save()
behaves as if it is.

By designing default Django behaviour to be "similar to auto-commit",
I think we've already decided that the DB-API default is wrong.

It's now a case of how Django implements the "similar to auto-commit"
behavior most cleanly and efficiently. I think the answer is:
- Get auto-commit connections from Python database adaptors by
  specifically requesting them
- Delete all of the commit_unless_managed() calls
- Change enter_transaction_management() / transaction.managed(True)
  to explicitly issue an SQL BEGIN
- Change leave_transaction_management() / transaction.commit /
  transaction.rollback to explicitly issue SQL COMMIT / ROLLBACK

I suspect that this will significantly simplify the Django codebase
vs.
trying to simulate both auto-commit and transaction behaviors on top
of a transactional connection - it would certainly remove most of the
mechanisms in django/db/transaction.py which track state, dirty, etc.

Cheers,

Richard.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.