#19544: IntegrityError during Many To Many add()
-------------------------------------+-------------------------------------
     Reporter:  Kronuz               |                    Owner:  nobody
         Type:                       |                   Status:  new
  Cleanup/optimization               |                  Version:  1.4
    Component:  Database layer       |               Resolution:
  (models, ORM)                      |             Triage Stage:
     Severity:  Normal               |  Someday/Maybe
     Keywords:                       |      Needs documentation:  0
    Has patch:  0                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by Patrick Robertson <django@…>):

 Looking at the code (very briefly), I think _add_items in
 db/models/fields/relate.py (line 672 ish) might be what's causing the
 problem.

 We're saving a list of ids `new_ids` which is later used for the bulk
 creation. As you can see, if this method were called twice at the same
 time for whatever reason (I think in my case it was probably a double
 submit of the form) then a race condition could occurr

-- 
Ticket URL: <https://code.djangoproject.com/ticket/19544#comment:6>
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/064.9321256412fe5587b29262480adcae5c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to