﻿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
34251	Paginator should warn if ordering is not deterministic	Alexandr Tatarinov	nobody	"As documented in tickets #28657 and #28261, at least some database backends will produce non-deterministic ordering when sorting by columns with non-unique values. 
This leads to inconsistent pagination, which I argue falls under the same category as paginating by unordered QuerySet. To make things worse, this one is easy to overlook, since non-unique columns like ""name"" can have mostly unique values and you need to have duplicates at the page borders to observe the issue, so it's more likely to happen in production environments after operating fine for quite a while.

I suggest we add a warning similar to the UnorderedObjectListWarning when total ordering as defined [https://github.com/django/django/blob/main/django/contrib/admin/views/main.py#L390  in admin changelist] is not specified.

The outstanding question is, how to realistically deal with this situation when ordering is provided by the end-user? It's typical to have i.e. ""sort by price asc/desc"" option in the UI or API, which will result in a warning since the price is not a unique column. Pushing responsibility to add ""pk"" to each sorting option to the front end does not seem like a reasonable way to me. This may be out of the scope of the current ticket, but I want to make sure we have a plan. I would say we also shouldn't insert pk automatically like ChangeList does, it'll at least break indexing as in this ticket #29943. Would like to hear your thoughts."	New feature	closed	Core (Other)	4.1	Normal	needsinfo			Unreviewed	0	0	0	0	0	0
