Fixed #18304 -- Optimized save() when update_can_self_select=False

Databases with update_can_self_select = False (MySQL for example)
generated non-necessary queries when saving a multitable inherited
model, and when the save resulted in update.
This commit is contained in:
Anssi Kääriäinen 2012-05-12 13:01:45 +03:00
parent 6219591f2e
commit d5c7f9efc3
3 changed files with 25 additions and 4 deletions

View file

@ -1,6 +1,6 @@
from __future__ import absolute_import
from django.test import TestCase, skipUnlessDBFeature
from django.test import TestCase
from django.db.models.signals import pre_save, post_save
from .models import Person, Employee, ProxyEmployee, Profile, Account
@ -123,9 +123,6 @@ class UpdateOnlyFieldsTests(TestCase):
self.assertEqual(len(pre_save_data), 0)
self.assertEqual(len(post_save_data), 0)
# A bug in SQLUpdateCompiler prevents this test from succeeding on MySQL
# Require update_can_self_select for this test for now. Refs #18304.
@skipUnlessDBFeature('update_can_self_select')
def test_num_queries_inheritance(self):
s = Employee.objects.create(name='Sara', gender='F')
s.employee_num = 1