Opened 7 years ago

Last modified 3 years ago

#28560 new Bug

distinct() on ordered queryset with restricted list of columns returns incorrect result — at Version 3

Reported by: Mariusz Felisiak Owned by: Mariusz Felisiak
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords: distinct values
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Mariusz Felisiak)

I think we should raise NotSupportedError when distinct() is used with values() (or values_list()) on ordered queryset and a list of fields in values() doesn't contain all fields from ORDER BY. It cannot return correct result because columns from ORDER BY clause must be included in SELECT.

Change History (2)

comment:2 by Mariusz Felisiak, 7 years ago

Summary: distinct() on None valuesdistinct() on ordered queryset with restricted list of columns returns incorrect result

comment:3 by Mariusz Felisiak, 7 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top