﻿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
33429	Wrong results when using .values().distinct() with default ordering	Adam Sołtysik	nobody	"The following test (added in `tests/ordering/tests.py`) fails, since columns from `Meta.ordering` are added to the query, essentially removing the effect of `.values()` and making the rows not distinct.

{{{
    def test_values_with_default_ordering(self):
        qs = Article.objects.values('author').distinct()
        self.assertEqual(qs.count(), len(qs.order_by()))  # OK
        self.assertEqual(qs.count(), len(qs))             # FAIL: 1 != 4
}}}

Even though this behaviour [https://docs.djangoproject.com/en/4.0/ref/models/querysets/#distinct is documented], it's quite unexpected that the default ordering still impacts such queries, even after fixing #14357. In #32811 it has been noted that ""the previous behavior [before #14357] was implicit, unexpected, and caused many support questions"". Probably the same could be said in this case. So shouldn't this also be fixed?"	Cleanup/optimization	closed	Database layer (models, ORM)	4.0	Normal	duplicate			Unreviewed	0	0	0	0	0	0
