summaryrefslogtreecommitdiff
path: root/tests/delete
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2015-12-13 23:46:41 -0500
committerSimon Charette <charette.s@gmail.com>2015-12-14 13:13:47 -0500
commitc402db2e2f3315dc3292526a6bdae36630026dfe (patch)
treee83c4b314783267aee3a58fa7e6c6d6cd60655ca /tests/delete
parent45ea00742b06393a76f2d553999a5c37e09dc7c3 (diff)
[1.9.x] Fixed #25882 -- Prevented fast deletes matching no rows from crashing on MySQL.
Thanks to Trac aliases gerricom for the report, raphaelmerx for the attempts to reproduce and Sergey Fedoseev and Tim for the review. Refs #16891 Backport of 8035cee92293f3319919c8248c7787ba43c05917 from master
Diffstat (limited to 'tests/delete')
-rw-r--r--tests/delete/tests.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/delete/tests.py b/tests/delete/tests.py
index c50f95e126..e874321744 100644
--- a/tests/delete/tests.py
+++ b/tests/delete/tests.py
@@ -502,3 +502,15 @@ class FastDeleteTests(TestCase):
# that + fast delete of the related objs.
self.assertNumQueries(2, a.delete)
self.assertEqual(User.objects.count(), 0)
+
+ def test_fast_delete_empty_no_update_can_self_select(self):
+ """
+ #25932 - Fast deleting on backends that don't have the
+ `no_update_can_self_select` feature should work even if the specified
+ filter doesn't match any row.
+ """
+ with self.assertNumQueries(1):
+ self.assertEqual(
+ User.objects.filter(avatar__desc='missing').delete(),
+ (0, {'delete.User': 0})
+ )