diff options
author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-01-16 10:22:02 +0100 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-01-17 08:24:08 +0100 |
commit | 0e2649fdf40cedc5be7e2c0e5f7711f315e36b84 (patch) | |
tree | e970a4cd9f3bd3d26f888c7c1342af753b440dcf /tests/aggregation | |
parent | c8a76059ff6ff37fb51972fe2ba8b9d9464af769 (diff) | |
download | django-0e2649fdf40cedc5be7e2c0e5f7711f315e36b84.tar.gz |
Fixed #34255 -- Made PostgreSQL backend use client-side parameters binding with psycopg version 3.
Thanks Guillaume Andreu Sabater for the report.
Co-authored-by: Florian Apolloner <apollo13@users.noreply.github.com>
Diffstat (limited to 'tests/aggregation')
-rw-r--r-- | tests/aggregation/tests.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py index 54e1e6f13a..c1ae9f0dd5 100644 --- a/tests/aggregation/tests.py +++ b/tests/aggregation/tests.py @@ -34,6 +34,7 @@ from django.db.models.functions import ( Cast, Coalesce, Greatest, + Least, Lower, Now, Pi, @@ -1614,6 +1615,20 @@ class AggregateTestCase(TestCase): ).annotate(total=Count("*")) self.assertEqual(dict(has_long_books_breakdown), {True: 2, False: 3}) + def test_group_by_nested_expression_with_params(self): + books_qs = ( + Book.objects.annotate(greatest_pages=Greatest("pages", Value(600))) + .values( + "greatest_pages", + ) + .annotate( + min_pages=Min("pages"), + least=Least("min_pages", "greatest_pages"), + ) + .values_list("least", flat=True) + ) + self.assertCountEqual(books_qs, [300, 946, 1132]) + @skipUnlessDBFeature("supports_subqueries_in_group_by") def test_aggregation_subquery_annotation_related_field(self): publisher = Publisher.objects.create(name=self.a9.name, num_awards=2) |