From a0f34d8fef2942e17c40e7009b355b661d30e138 Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Thu, 19 Dec 2019 09:10:02 +0100 Subject: [PATCH] Refs #31094 -- Added test for not using aliases in GROUP BY clauses. --- tests/aggregation/tests.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py index a93c39e3d5..322db8ea1a 100644 --- a/tests/aggregation/tests.py +++ b/tests/aggregation/tests.py @@ -1138,6 +1138,8 @@ class AggregateTestCase(TestCase): with self.assertNumQueries(1) as ctx: list(publisher_qs) self.assertEqual(ctx[0]['sql'].count('SELECT'), 2) + # The GROUP BY should not be by alias either. + self.assertEqual(ctx[0]['sql'].lower().count('latest_book_pubdate'), 1) @skipUnlessDBFeature('supports_subqueries_in_group_by') def test_group_by_subquery_annotation(self):