﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
31204	Paginator with count = 0 always produce non-limited QuerySet.	Alexander Pervakov	nobody	"Problem:

Custom paginator, i.e. approximate PostgreSQL paginator based on pg_class.reltuples, could return count = 0 when vacuum haven't run yet. QuerySet doesn't set limit on following select query, and in my case I've got max memory exceeded error because Django Admin have tried to visualise all 3M rows from my DB.

Solution:

As a workaround for that case one should always use limit for one's custom ``count``, a good candidate for this is a Paginator.per_page attribute.
Django itself could limits count as well, but when I've tried to implement it myself a 3 tests was failed (because in these tests Django Admin trust to ChangeList.result_count), and I've no time for deeper investigation.
So my github PR isn't going beyond and only point to this case in a docs and in a count method comment to help curious ones in their custom Paginator implementation."	Bug	closed	Core (Other)	3.0	Normal	needsinfo			Unreviewed	0	0	0	0	0	0
