Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#28399 closed Bug (fixed)

QuerySet.count() doesn't work on combined queries (union, intersection, difference)

Reported by: Florian Apolloner Owned by: nobody
Component: Database layer (models, ORM) Version: 1.11
Severity: Release blocker Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Currently combined queries do not issue COUNT(*) in the database which is not really efficient one wants to paginate through them.

Change History (3)

comment:1 Changed 2 years ago by Tim Graham

Severity: NormalRelease blocker
Summary: Combined queries (UNION etc) do not properly count in the database.QuerySet.count() doesn't work on combined queries (union, intersection, difference)
Triage Stage: UnreviewedAccepted
Version: master1.11

I didn't realize this could be supported (see #27995). #27982 and #27990 were duplicates.

comment:2 Changed 2 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: newclosed

In adab280c:

Fixed #28399 -- Fixed QuerySet.count() for union(), difference(), and intersection() queries.

comment:3 Changed 2 years ago by Tim Graham <timograham@…>

In 9350f77c:

[1.11.x] Fixed #28399 -- Fixed QuerySet.count() for union(), difference(), and intersection() queries.

Backport of adab280cefb15659c39558ac26ea392b0a1e456c from master

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