Closed
Description
Checklist
- I have verified that that issue exists against the
master
branch of Django REST framework. - I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
- This is not a usage question. (Those should be directed to the discussion group instead.)
- This cannot be dealt with as a third party library. (We prefer new functionality to be in the form of third party libraries where possible.) - This can be done with a third party library, but I feel that it's a sensible improvement.
- I have reduced the issue to the simplest possible case.
- I have included a failing test as a pull request. (If you are unable to do so we can still accept the issue.) - I haven't, since I'm not sure this is considered a bug/desired feature.
Steps to reproduce
- Add a paginated view for an empty model (Only applies to LimitOffsetPagination)
- Make a GET request.
Expected behavior
- If the count query returns 0, the actual query shouldn't be re-run
Actual behavior
- The query is re-run.
This isn't a problem in the case I described, but in some cases the query can get quite complex and slow. Even if the view isn't wrapped in a transaction and it is possible to get rows on the second run, the results will be inconsistent, but the maybe expensive query is re-run.
Metadata
Metadata
Assignees
Labels
No labels