#35437: Exists subquery ignores ordering when it's distinct
-------------------------------------+-------------------------------------
Reporter: Kevin Marsh | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
subquery,exists,ordering,distinct |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):
* stage: Unreviewed => Accepted
* type: Uncategorized => Bug
Comment:
The report makes sense. We could go two ways here
1. Clear `distinct_fields` as well as it's unnecessary (we only care about
the existence of a single row after all)
2. Avoid
[https://github.com/django/django/blob/34a503162fe222033a1cd3249bccad014fcd1d20/django/db/models/sql/query.py#L651
forcing the removal of ordering] since the `clear_ordering` method
[https://github.com/django/django/blob/34a503162fe222033a1cd3249bccad014fcd1d20/django/db/models/sql/query.py#L2264
is a noop when distinct fields are defined].
--
Ticket URL: <https://code.djangoproject.com/ticket/35437#comment:1>
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/0107018f502270cf-9487d775-b77e-42f3-be27-9792a3afbc85-000000%40eu-central-1.amazonses.com.