#18741: Small cleanup to split_exclude()
-------------------------------------+-------------------------------------
               Reporter:  akaariai   |          Owner:  nobody
                   Type:             |         Status:  new
  Cleanup/optimization               |        Version:  master
              Component:  Database   |       Keywords:
  layer (models, ORM)                |      Has patch:  0
               Severity:  Normal     |    Needs tests:  0
           Triage Stage:  Accepted   |  Easy pickings:  0
    Needs documentation:  0          |
Patch needs improvement:  0          |
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 sql.query.split_exclude() contains this call:
 {{{
 query = Query(self.model)
 query.add_filter(filter_expr, can_reuse=can_reuse)
 }}}
 Here a new subquery is created, and the can_reuse set is a set of joins
 that are reusable from the outer query.

 The problem is that passing the can_reuse here doesn't make any sense -
 the new query contains no joins so there of course isn't anything to
 reuse. If the .add_filter() adds something to the can_reuse set, that
 addition will be incorrect for the outer query. However I am not sure if
 it is possible to create an actual error because of this.

 This also makes it slightly easier to see what happens in split_exclude().

 When I got rid of can_reuse all tests pass.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/18741>
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 https://groups.google.com/groups/opt_out.


Reply via email to