mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
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>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user