Opened 5 years ago

Closed 5 years ago

#30569 closed Bug (duplicate)

Count and Sum annotation interfere with each other.

Reported by: Antoine Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

While constructing a complex QuerySet, I ran into an issue where a Sum annotation on a relation would yield a different result whether or not another, seemingly unrelated Count annotation would be added. Everything needed to reproduce the issue is detailed here, including a dump of the database I used to illustrate the issue:

https://stackoverflow.com/questions/56567841/django-count-and-sum-annotations-interfere-with-each-other

Change History (2)

comment:1 by Antoine, 5 years ago

I can push the test project on Github if it is helpful -- let me know.

comment:2 by Mariusz Felisiak, 5 years ago

Resolution: duplicate
Status: newclosed
Summary: Count and Sum annotation interfere with each other in a QuerySet involving multiple relationsCount and Sum annotation interfere with each other.
Version: 2.2master

Duplicate of #10060 (see ​documentation).

Note: See TracTickets for help on using tickets.
Back to Top