#17600: Error in encapsulates filters (Q)
-------------------------------------+-------------------------------------
     Reporter:  pmartin              |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  1.3
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |             Triage Stage:  Ready for
     Keywords:                       |  checkin
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by akaariai):

 * needs_better_patch:  1 => 0
 * stage:  Accepted => Ready for checkin


Comment:

 I have added another version of the patch, available from
 https://github.com/akaariai/django/tree/refactor_utils_tree_2.

 The add_q -> _add_q + all the code related to doing HAVING splits is still
 ugly... But it is also working more correctly than current code, and
 fixing at least 5 tickets.

 The underlying problem is that the logic *is* somewhat ugly. The having
 splits must be done for any subtree starting with OR and containing an
 aggregate somewhere in the subtree. Also, the negated status of the tree
 must be appended to the subtree. Still, the references to the aggregates
 can be in F() expressions, and these nest, too...

 The patches approach is to split the having parts before adding the
 filters. The current approach is to build the having and the where trees
 in parallel, but that doesn't work nicely. There is still an approach
 where the having parts are split out in compiler stage, and that might
 work nicely. Other ideas are welcome...

 So, I think I will just commit the code and then see if there is some way
 to make the changes still cleaner.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17600#comment:28>
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].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to