#7818: Merging querysets can result in wrong operator grouping
---------------------------------------+------------------------------------
          Reporter:  andrewbadr        |         Owner:  mtredinnick
            Status:  closed            |     Milestone:             
         Component:  Database wrapper  |       Version:  SVN        
        Resolution:  worksforme        |      Keywords:             
             Stage:  Unreviewed        |     Has_patch:  0          
        Needs_docs:  0                 |   Needs_tests:  0          
Needs_better_patch:  0                 |  
---------------------------------------+------------------------------------
Changes (by mir):

  * status:  new => closed
  * needs_better_patch:  => 0
  * resolution:  => worksforme
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

 I tested it like this:

 {{{
  qs = (models.Foo.objects.filter(a1=1)|models.Foo.objects.filter(a2=2)) &
 models.Foo.objects.filter(a3=3)
 }}}

 Here's the resulting query which I got by putting a breakpoint into
 MySQLdb:

 {{{
 SELECT `testapp_foo`.`id`, `testapp_foo`.`a1`, `testapp_foo`.`a2`,
 `testapp_foo`.`a3` FROM `testapp_foo` WHERE ((`testapp_foo`.`a1` = BINARY
 1  OR `testapp_foo`.`a2` = BINARY 2 ) AND `testapp_foo`.`a3` = BINARY 3 )
 }}}

 So the query goes out fine. If you're results are different they are
 repeatable, please tell us more about your setup.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/7818#comment:1>
Django Code <http://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 this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to