#16554: Unnecessary join when using a reverse foreign-key relationship in 
separate
filter or aggregate calls
-------------------------------------+-------------------------------------
               Reporter:             |          Owner:  nobody
  bendavis78                         |         Status:  closed
                   Type:  Bug        |      Component:  Database layer
              Milestone:             |  (models, ORM)
                Version:  SVN        |       Severity:  Normal
             Resolution:  invalid    |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |    Needs tests:  0
    Needs documentation:  0          |  Easy pickings:  0
Patch needs improvement:  0          |
                  UI/UX:  0          |
-------------------------------------+-------------------------------------

Comment (by akaariai):

 If I am not mistaken, the aggregate example is valid - it produces wrong
 results. Author having two different SCIFI books will have pages
 calculated twice.

 But the chained filters is not valid, as one query is asking for a model
 which has a book with genre of SCIFI and more than 500 pages, the other is
 asking for a model which has a book with genre of SCIFI and a book which
 has more than 500 pages. So, in the first example there must be one
 matching book, in the second example the books matching the condition can
 be different ones.

 I am leaving this as closed, as I don't know what to do for a half-valid
 ticket and I haven't actually verified that the aggregate example produces
 wrong results.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/16554#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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to