diff options
| author | Anssi Kääriäinen <akaariai@gmail.com> | 2012-08-10 22:00:21 +0300 |
|---|---|---|
| committer | Anssi Kääriäinen <akaariai@gmail.com> | 2012-10-31 08:19:44 +0200 |
| commit | 68847135bc9acb2c51c2d36797d0a85395f0cd35 (patch) | |
| tree | c8389fd5798a804aeb05154c4beacd1f784f2fb6 /tests | |
| parent | 9bf0eedba581ba66b8b8391a7e611d6cf7ef5448 (diff) | |
Removed dupe_avoidance from sql/query and sql/compiler.py
The dupe avoidance logic was removed as it doesn't seem to do anything,
it is complicated, and it has nearly zero documentation.
The removal of dupe_avoidance allowed for refactoring of both the
implementation and signature of Query.join(). This refactoring cascades
again to some other parts. The most significant of them is the changes
in qs.combine(), and compiler.select_related_descent().
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/queries/tests.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/regressiontests/queries/tests.py b/tests/regressiontests/queries/tests.py index c2a4ad1caf..2dbe75fd24 100644 --- a/tests/regressiontests/queries/tests.py +++ b/tests/regressiontests/queries/tests.py @@ -1046,6 +1046,18 @@ class Queries4Tests(BaseQuerysetTest): self.assertQuerysetEqual(q1, ["<Item: i1>"]) self.assertEqual(str(q1.query), str(q2.query)) + def test_combine_join_reuse(self): + # Test that we correctly recreate joins having identical connections + # in the rhs query, in case the query is ORed together. Related to + # ticket #18748 + Report.objects.create(name='r4', creator=self.a1) + q1 = Author.objects.filter(report__name='r5') + q2 = Author.objects.filter(report__name='r4').filter(report__name='r1') + combined = q1|q2 + self.assertEquals(str(combined.query).count('JOIN'), 2) + self.assertEquals(len(combined), 1) + self.assertEquals(combined[0].name, 'a1') + def test_ticket7095(self): # Updates that are filtered on the model being updated are somewhat # tricky in MySQL. This exercises that case. |
