mirror of
https://github.com/django/django.git
synced 2025-11-25 13:13:28 +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:
parent
e645f27907
commit
7acef095d7
5 changed files with 54 additions and 49 deletions
|
|
@ -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())
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue