mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #23576 -- Implemented multi-alias fast-path deletion in MySQL backend.
This required moving the entirety of DELETE SQL generation to the compiler where it should have been in the first place and implementing a specialized compiler on MySQL/MariaDB. The MySQL compiler relies on the "DELETE table FROM table JOIN" syntax for queries spanning over multiple tables.
This commit is contained in:
committed by
Mariusz Felisiak
parent
e645f27907
commit
7acef095d7
@@ -535,9 +535,7 @@ class FastDeleteTests(TestCase):
|
||||
a = Avatar.objects.create(desc='a')
|
||||
User.objects.create(avatar=a)
|
||||
u2 = User.objects.create()
|
||||
expected_queries = 1 if connection.features.update_can_self_select else 2
|
||||
self.assertNumQueries(expected_queries,
|
||||
User.objects.filter(avatar__desc='a').delete)
|
||||
self.assertNumQueries(1, User.objects.filter(avatar__desc='a').delete)
|
||||
self.assertEqual(User.objects.count(), 1)
|
||||
self.assertTrue(User.objects.filter(pk=u2.pk).exists())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user