summaryrefslogtreecommitdiff
path: root/tests/aggregation/tests.py
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2022-09-28 01:34:21 -0400
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-10-06 11:51:32 +0200
commitb7b28c7c189615543218e81319473888bc46d831 (patch)
tree71c1cf6421379603d53f2bb1cd0e126e034f4413 /tests/aggregation/tests.py
parent3d734c09ff0138441dfe0a59010435871d17950f (diff)
Refs #31150 -- Enabled implicit GROUP BY aliases.
This ensures implicit grouping from aggregate function annotations groups by uncollapsed selected aliases if supported. The feature is disabled on Oracle because it doesn't support it.
Diffstat (limited to 'tests/aggregation/tests.py')
-rw-r--r--tests/aggregation/tests.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py
index 044dcdc690..ae94af8eaa 100644
--- a/tests/aggregation/tests.py
+++ b/tests/aggregation/tests.py
@@ -1639,12 +1639,12 @@ class AggregateTestCase(TestCase):
)
.annotate(count=Count("authors"))
)
- self.assertSequenceEqual(books_qs, [book])
- # FIXME: GROUP BY doesn't need to include a subquery with
- # non-multivalued JOINs, see Col.possibly_multivalued (refs #31150):
- # with self.assertNumQueries(1) as ctx:
- # self.assertSequenceEqual(books_qs, [book])
- # self.assertEqual(ctx[0]['sql'].count('SELECT'), 2)
+ with self.assertNumQueries(1) as ctx:
+ self.assertSequenceEqual(books_qs, [book])
+ # Outerquery SELECT, annotation SELECT, and WHERE SELECT but GROUP BY
+ # selected alias, if allowed.
+ if connection.features.allows_group_by_refs:
+ self.assertEqual(ctx[0]["sql"].count("SELECT"), 3)
@skipUnlessDBFeature("supports_subqueries_in_group_by")
def test_aggregation_nested_subquery_outerref(self):