#8419: Fix race in get_or_create() which can lead to update
-----------------------------------------------------------------------+----
Reporter: Richard Davies <[EMAIL PROTECTED]> | Owner:
nobody
Status: new |
Milestone: 1.0
Component: Database wrapper |
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've just posted several patches, so I'll explain what they are!
[[BR]]
The original fix_get_or_create_race.v2.diff is uncontroversial, fixes a
race in get_or_create(), and should be applied regardless of everything
that follows.
[[BR]]
doc-improvement.diff is a minor suggestion to improve the documentation of
the force_insert and force_update flags to save().
[[BR]]
option1-create-patch.diff and option2-create-patch.diff are two
alternative patches to create(). We should get the semantics of create()
clear before 1.0, so a design decision is needed here.
- Option 1 is my preferred solution, in which create() always performs an
SQL insert and is documented as doing so. This seems the obvious meaning
of the word "create"! I have run with this patch, which causes no problems
for me.
- Option 2 is an alternative, prompted by Malcolm's comments on Django
developers. In this version create() continues to behave as at present -
i.e. it usually performs an SQL insert, but may perform an SQL update in
some cases. I add force_insert and force_update flags so that an advanced
user can guarantee one or the other behavior and ensure that they will not
lose data.
--
Ticket URL: <http://code.djangoproject.com/ticket/8419#comment:2>
Django Code <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
-~----------~----~----~----~------~----~------~--~---