#34706: Aggregation on annotated field fails starting on Django 4.2.2
-----------------------------------------+------------------------
Reporter: Lorenzo Peña | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 4.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
This would be the minimum reproducible example:
{{{
from django.db import models
from django.db.models import F, Sum
class House(models.Model):
price = models.IntegerField()
House.objects.annotate(total=F("price")).aggregate(total=Sum("total"))
# ProgrammingError: column "total" does not exist
# SELECT SUM("total") AS "total" FROM "app_house"
}}}
This works in Django 4.2.1.
--
Ticket URL: <https://code.djangoproject.com/ticket/34706>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.