Changes between Version 8 and Version 15 of Ticket #28560


Ignore:
Timestamp:
Oct 30, 2020, 9:14:05 AM (3 years ago)
Author:
Tobias McNulty
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #28560

    • Property Triage Stage UnreviewedAccepted
    • Property Owner Mariusz Felisiak removed
    • Property Status assignednew
  • Ticket #28560 – Description

    v8 v15  
    1 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`, then it doesn't return correct result because columns from `ORDER BY` clause must be included in `SELECT`. As Simon suggested we should wrap a query in a subquery (see related tickets #7070, #5321).
     1When `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`, then it doesn't return correct result because columns from `ORDER BY` clause must be included in `SELECT`.
     2
     3After some discussion on the mailing list (https://groups.google.com/g/django-developers/c/DNVRFqVBsfk/m/xDUvaq3DAAAJ) it looks like the consensus is to require an explicit opt-in or raise an error (i.e., never add a column implicitly if the user specified a list of columns via values() or values_list()).
Back to Top