#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.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070189454ca761-1c648f0c-87a1-4ec6-a81a-e827e1a95a13-000000%40eu-central-1.amazonses.com.

Reply via email to