#19415: Invalid result when using multiple reverse foreign-key filters together
with reverse foreign-key aggregate
---------------------------------+--------------------------------------
Reporter: svniemeijer@… | Owner: nobody
Type: Bug | Status: closed
Component: ORM aggregation | Version: 1.5-beta-1
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
---------------------------------+--------------------------------------
Changes (by russellm):
* status: new => closed
* needs_docs: => 0
* resolution: => invalid
* needs_tests: => 0
* needs_better_patch: => 0
Comment:
As far as I can make out, this is working as expected (for suitably
confusing values of expected :-).
The catch is that:
{{{
Author.objects.filter(books__published__gte=date(2012, 11,
1)).filter(books__published__lte=date(2012, 11, 30))
}}}
and
{{{
Author.objects.filter(books__published__gte=date(2012, 11, 1),
books__published__lte=date(2012, 11, 30))
}}}
are not interchangeable. By using a single filter clause, you're telling
Django to use a single join table. Splitting the filter means 2 joins are
used (hence the T3 table in the "wrong" query). The involvement of
aggregates here is a red herring; the underlying issue is the filters.
--
Ticket URL: <https://code.djangoproject.com/ticket/19415#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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.