#26368: Order of &-ing Q objects affects results in edge case
-------------------------------------+-------------------------------------
     Reporter:  Floris den Hengst    |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  1.9
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  Query Q order        |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Can Sarıgöl):

 * cc: Can Sarıgöl (added)


Comment:

 Hi, I'm working on this issue. to fix it and understand deeply. as far as
 I understand:), the problem is
 
[https://github.com/django/django/blob/8aad3321ed6f0b603361767a4fe00d046b5fdd34/django/utils/tree.py#L113
 here]. When we add a {{{combine}}} q node and this q contains
 {{{negated=True}}} clauses, this {{{~Q}}}s are associated with other
 {{{Q}}}. I couldn't find why but if I change the code like this:
 {{{self.children.insert(0, data)}}}, I can see the query is fixed.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/26368#comment:3>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/061.478f53a114081cbd887053f184be33ed%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to