#28281: Queryset.count() with a union takes the first id of the results objects
-------------------------------------+-------------------------------------
Reporter: Amir | Owner: nobody
Tugendhaft |
Type: Bug | Status: new
Component: Database | Version: 1.11
layer (models, ORM) | Keywords: Queryset, count,
Severity: Normal | union
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
I have a query I built with 2 querysets with a union between them, and I
get a wrong count for them.
For each one of them the queryset.count() is correct, but after the union
the queryset.count() is the first id of the objects results.
I used queeryset.query to see the raw query and its fine.
I'm attaching 2 photos so you could see the problem:
The first - showing 33 results is when I used '|' with the 2 querysets.
This workaround is not good for me, since the UNION's advantage is that I
get the first query's results on top of the rest
The second - showing 25103 results is when I used the .union()
--
Ticket URL: <https://code.djangoproject.com/ticket/28281>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/051.b716e161b2121e816380ee3bd7d857b9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.