summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/aggregation_regress/tests.py11
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)