#28560: distinct() on ordered queryset with restricted list of columns returns
incorrect result
-------------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: (none)
Type: Bug | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: distinct values | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Tobias McNulty):
After 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()).
I am not too familiar with the ORM. I believe these columns are added in
`get_extra_select()` (`django/db/models/sql/compiler.py`), which could be
adapted initially to raise a deprecation warning and eventually an
exception. Does that sound right?
I may not have time right away so if anyone feels like picking this up, go
for it.
--
Ticket URL: <https://code.djangoproject.com/ticket/28560#comment:14>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.a210455bf6d65fd18f4186f0ddfe7ef5%40djangoproject.com.