#26323: TransactionManagementError is raised when autocommit is false
-------------------------------------+-------------------------------------
     Reporter:  tltx                 |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  wontfix
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by aaugustin):

 * status:  new => closed
 * resolution:   => wontfix


Comment:

 Thanks for providing this example. Now I can see what you're talking
 about.

 Django's transaction management is specifically designed to prevent the
 following pattern, which appears in your test:

 1. start a transaction
 2. run a statement that fails, typically because it breaks an integrity
 constraint
 3. run another statement without rolling back

 That pattern isn't portable across databases. It doesn't work on
 PostgreSQL.

 Also, in my opinion, it's an illegal behavior for a transactional
 database. A transaction is supposed to guarantee that either all
 statements have executed or none of them.

 In my example, the first statement fails, the second succeeds, and MySQL
 happily commits the transaction, even though only one of the two
 statements executed.

 To sum up, while MySQL doesn't care about transactional integrity, Django
 does. It's a design decision I made when I wrote the current transaction
 management.

 If you want to discuss this decision, please write to the
 DevelopersMailingList.

--
Ticket URL: <https://code.djangoproject.com/ticket/26323#comment:9>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.93a82047dc5f6fc875bb4f5d2de5c017%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to