#6422: Support for 'DISTINCT ON' queries with QuerySet.distinct()
-------------------------------------+-------------------------------------
Reporter: Manfred Wassmann | Owner: jgelens
<manolo@…> | Status: assigned
Type: New feature | Version: SVN
Component: Database layer | Resolution:
(models, ORM) | Triage Stage: Accepted
Severity: Normal | Needs documentation: 0
Keywords: dceu2011 | Patch needs improvement: 0
Has patch: 1 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Comment (by akaariai):
I hope to do a final cleanup tomorrow. I still think it is a good idea to
throw `NotImplementedError` for aggregate & annotate (this is actually
quite simple: in each method check if self.distinct_fields: raise
`NotImplementedError`). The reason is that annotate + DISTINCT ON actually
somewhat works, sometimes. But it doesn't work in any meaningful way. So
to avoid backwards compatibility issues if annotate + distinct_on
combination is going to ever be supported, it is good that there is no
behaviour Django must support. The exceptions are simple enough to
implement, so IMHO this is a good idea still. Sorry for coming back to
this again and again. :)
In addition I will check if there is some easy way to avoid the code
duplication between get_ordering and get_distinct join generation (in
compiler.py). It is a good idea, as actually both of them _must_ generate
same joins, otherwise you will get errors on ordering not matching prefix
of DISTINCT ON.
--
Ticket URL: <https://code.djangoproject.com/ticket/6422#comment:63>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.