diff options
| author | Anssi Kääriäinen <akaariai@gmail.com> | 2012-10-08 18:36:51 +0300 |
|---|---|---|
| committer | Anssi Kääriäinen <akaariai@gmail.com> | 2012-10-08 18:40:09 +0300 |
| commit | a62d53c03252bdf82b21b64874efe053160cbdb7 (patch) | |
| tree | bdcb14d13a72b796d715753225cf08e6a46834b1 /tests | |
| parent | 4797ad80da57f3f8a7c029008f3e937240cf23e6 (diff) | |
Fixed #19087 -- Ensured query's base table is never LOUTER joined
This fixes a regression created by join promotion logic refactoring:
01b9c3d5193fe61b82ae8b26242a13fdec22f211
Thanks to Ivan Virabyan for the report.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/aggregation_regress/tests.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/regressiontests/aggregation_regress/tests.py b/tests/regressiontests/aggregation_regress/tests.py index b9f3ab27eb..af0f421502 100644 --- a/tests/regressiontests/aggregation_regress/tests.py +++ b/tests/regressiontests/aggregation_regress/tests.py @@ -878,3 +878,14 @@ class AggregationTests(TestCase): connection.ops.convert_values(testData, testField), testData ) + + def test_annotate_joins(self): + """ + Test that the base table's join isn't promoted to LOUTER. This could + cause the query generation to fail if there is an exclude() for fk-field + in the query, too. Refs #19087. + """ + qs = Book.objects.annotate(n=Count('pk')) + self.assertIs(qs.query.alias_map['aggregation_regress_book'].join_type, None) + # Check that the query executes without problems. + self.assertEqual(len(qs.exclude(publisher=-1)), 6) |
