#35613: SQL params mismatch when using ArrayAgg with timezone override ----------------------------------+-------------------------------------- Reporter: Claudia Onorato | Owner: (none) Type: Bug | Status: new Component: contrib.postgres | Version: 5.0 Severity: Normal | Resolution: Keywords: | Triage Stage: Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 ----------------------------------+-------------------------------------- Comment (by Simon Charette):
Hey Claudia, thank you for your report I'm pretty sure this is a duplicate of #35339 which was fixed by c8df2f994130d74ec35d32a36e30aad7d6ea8e3a which will be part of the upcoming 5.1 release (expected August 2024). It wasn't backported as when it was discovered, 4 months ago, the issue had existed since the introduction of `ArrayAgg` as you've discovered. I've confirmed with the following test {{{#!diff diff --git a/tests/postgres_tests/test_aggregates.py b/tests/postgres_tests/test_aggregates.py index b72310bdf1..9c2ba53cba 100644 --- a/tests/postgres_tests/test_aggregates.py +++ b/tests/postgres_tests/test_aggregates.py @@ -654,6 +654,24 @@ def test_string_agg_filter_in_subquery_with_exclude(self): [self.aggs[0]], ) + def test_ticket_35613(self): + import zoneinfo + from django.utils import timezone + from django.contrib.postgres.aggregates import ArrayAgg + from django.db.models import Q + from .models import Publisher + + with timezone.override(zoneinfo.ZoneInfo("America/Toronto")): + list( + Room.objects.annotate( + books_date=ArrayAgg( + "hotelreservation__start__date", + filter=Q(id=100), + ordering=("hotelreservation__start__date",), + ) + ) + ) + def test_ordering_isnt_cleared_for_array_subquery(self): inner_qs = AggregateTestModel.objects.order_by("-integer_field") qs = AggregateTestModel.objects.annotate( }}} Please re-open if you can reproduce against `Django==5.1.b1`. -- Ticket URL: <https://code.djangoproject.com/ticket/35613#comment:1> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/01070190c29e1bc2-a0b682d7-14fd-4a03-a174-a8e3b9f6eb74-000000%40eu-central-1.amazonses.com.