#9205: Add savepoint protection to Model.save()
-----------------------------------------------------------------------+----
Reporter: Richard Davies <[EMAIL PROTECTED]> | Owner:
nobody
Status: new |
Milestone:
Component: Database layer (models, ORM) |
Version: SVN
Resolution: |
Keywords:
Stage: Design decision needed |
Has_patch: 1
Needs_docs: 0 |
Needs_tests: 0
Needs_better_patch: 0 |
-----------------------------------------------------------------------+----
Comment (by Richard Davies <[EMAIL PROTECTED]>):
I hadn't thought of it as the same as #8739, but you're right. However, in
#8739 I thought it was limited to force_insert/force_update (advanced
features), whereas now I realize it also happens in the more common case
of normal save() and unique fields.
If it helps your decision, my thinking was as follows:
- The error "current transaction is aborted, commands ignored until end
of transaction block" is Postgresql-specific, as far as I know
- Django savepoints are also Postgresql-specific, and [8314] says that
they were added to enable rollback in case of this error
- The options are
1. [current] Savepoints are the caller's responsibility. Ideally the
caller should always use them, but they only actually do anything on
Postgresql, so it's easy to write code (like the example in the ticket),
which is official incorrect but actually works on all other databases.
2. [proposed] Savepoints become the responsibility of save(), so
behavior is consistent across database backends.
For what it's worth, I did the speed tests, and can't measure the
overhead.
--
Ticket URL: <http://code.djangoproject.com/ticket/9205#comment:2>
Django <http://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 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-updates?hl=en
-~----------~----~----~----~------~----~------~--~---