#28292: ORing on ManyToMany to same model can result in duplicate items in
queryset
-------------------------------------+-------------------------------------
Reporter: Till Theato | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Till Theato):
I am aware of Queryset.distinct(), however I could not believe that the
observed behavior was expected. Before reporting this bug I already tried
using distinct on the original query where the problem occurred, but this
did not help because I calculate a cumulative sum in an annotation of the
query using a custom Func:
{{{#!python
class CumSum(Func):
function = 'sum'
template = '%(function)s(%(expressions)s) OVER (ORDER BY created)'
}}}
The annotation happens before distinctness is enforced and therefore the
CumSum of entries after duplication is wrong.
Looks like I will have to pull that out of DB then – if the reported
problem is really expected behavior.
--
Ticket URL: <https://code.djangoproject.com/ticket/28292#comment:4>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/063.1a393049511b81eb9744f7ec35756683%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.