Re: [Django] #33992: QuerySet.annotate() with subquery and aggregation crashes. (was: Count subquery issue)

3 views
Skip to first unread message

Django

unread,
Sep 7, 2022, 1:57:54 PM9/7/22
to django-...@googlegroups.com
#33992: QuerySet.annotate() with subquery and aggregation crashes.
-------------------------------------+-------------------------------------
Reporter: Fernando Flores | Owner: nobody
Villaça |
Type: Bug | Status: new
Component: Database layer | Version: 4.1
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: database, orm, | Triage Stage: Accepted
aggregation |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak):

I was able to reproduce this issue with:
{{{
Post.objects.annotate(
is_following=Exists(
request_user.following.filter(id=OuterRef("user__id"))
),
).annotate(likes=Count("liked_by"))
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33992#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Reply all
Reply to author
Forward
0 new messages