#3592: Allowing Q Objects to select between OUTER and INNER joins (semi-
intelligently)
--------------------------------+-------------------------------------------
   Reporter:  [EMAIL PROTECTED]     |                Owner:  adrian             
   
     Status:  new               |            Component:  Database wrapper      
    Version:  SVN               |           Resolution:                        
   Keywords:  Q,QuerySet,JOINs  |                Stage:  Design decision needed
  Has_patch:  1                 |           Needs_docs:  0                     
Needs_tests:  1                 |   Needs_better_patch:  1                     
--------------------------------+-------------------------------------------
Changes (by [EMAIL PROTECTED]):

  * needs_better_patch:  0 => 1

Comment:

 Some more things:
 
 I realized that the ``correct way'' to do ORing is by use of UNION. For
 example, if I have three models:
 X, Y, and Z (each with parameters a,b,c) and both Y and Z foreign key to
 X:  Z --> X and Y --> X. Then:
 (They are all in app `package')
 
 Q(y__a__isnull = False) | Q(z__b__isnull = False) should yield the
 following query:
 (approximate)
 SELECT * FROM package_x
     INNER JOIN "package_y" AS "package_x__y" ON
       package_x.id = package_x__y.x_id
         WHERE package_x__y.a IS NOT NULL
 
 UNION
 SELECT * FROM package_x
     INNER JOIN "package_z" AS "package_x__z" ON
       package_x.id = package_x__z.x_id
         WHERE package_x__z.b IS NOT NULL
 
 
 
 Is this clear?
 Unfortunately, it would take some rewriting of django to even attempt
 this.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/3592#comment:3>
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