diff options
author | Simon Charette <charette.s@gmail.com> | 2023-01-06 09:10:16 -0500 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-01-09 10:52:51 +0100 |
commit | dd68af62b2b27ece50d434f6a351877212e15c3f (patch) | |
tree | ca7b43eebd1198c016d3d50a3ade216614237179 /tests/postgres_tests | |
parent | 016bead6a23989adec5c7ee6948db7ce2fc5e89b (diff) | |
download | django-dd68af62b2b27ece50d434f6a351877212e15c3f.tar.gz |
Fixed #34176 -- Fixed grouping by ambiguous aliases.
Regression in b7b28c7c189615543218e81319473888bc46d831.
Refs #31377.
Thanks Shai Berger for the report and reviews.
test_aggregation_subquery_annotation_values_collision() has been
updated as queries that are explicitly grouped by a subquery should
always be grouped by it and not its outer columns even if its alias
collides with referenced table columns. This was not possible to
accomplish at the time 10866a10 landed because we didn't have compiler
level handling of colliding aliases.
Diffstat (limited to 'tests/postgres_tests')
-rw-r--r-- | tests/postgres_tests/test_array.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py index 4808f88689..feebbd6f59 100644 --- a/tests/postgres_tests/test_array.py +++ b/tests/postgres_tests/test_array.py @@ -449,8 +449,8 @@ class TestQuerying(PostgreSQLTestCase): expected, ) - @skipUnlessDBFeature("allows_group_by_refs") - def test_group_by_order_by_aliases(self): + @skipUnlessDBFeature("allows_group_by_select_index") + def test_group_by_order_by_select_index(self): with self.assertNumQueries(1) as ctx: self.assertSequenceEqual( NullableIntegerArrayModel.objects.filter( @@ -467,7 +467,7 @@ class TestQuerying(PostgreSQLTestCase): ) alias = connection.ops.quote_name("field__0") sql = ctx[0]["sql"] - self.assertIn(f"GROUP BY {alias}", sql) + self.assertIn("GROUP BY 1", sql) self.assertIn(f"ORDER BY {alias}", sql) def test_index(self): |