#28099: Reuse of UpdateQuery breaks complex delete updates
-------------------------------------+-------------------------------------
Reporter: milosu | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by milosu):
The root cause is the reuse of the sql.UpdateQuery(model) instance in the
inner forloop.
Repeated call to add_update_values called from update_batch is essentially
adding value items to self.values array of the Query object.
This can not be tested explicitly in the test case due to the way how the
delete method on the collector is structured.
The best way how to deal with this bug is to prevent the reuse of
UpdateQuery.
I can polish the testcase somehow per your instructions, but keep in mind
that the reproducibility of the issue is hard.
This is a critical ORM bug, which is present in Django since ages, with
ability to randomly corrupt data in the database.
--
Ticket URL: <https://code.djangoproject.com/ticket/28099#comment:4>
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.e545a749285468589d306b422202bec9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.