#2076: order_by with related table does not work
---------------------------+------------------------------------------------
   Reporter:  mtredinnick  |                Owner:  mtredinnick     
     Status:  new          |            Component:  Database wrapper
    Version:  SVN          |           Resolution:                  
   Keywords:               |                Stage:  Accepted        
  Has_patch:  1            |           Needs_docs:  0               
Needs_tests:  0            |   Needs_better_patch:  1               
---------------------------+------------------------------------------------
Comment (by anonymous):

 There's one problem.
 
 {{{
 class A(models.Model):
   name = models.CharField()
 
 class B(models.Model):
   [...]
   a = ForeignKey(A, null=True)
 }}}
 
 The following query will use an {{{INNER JOIN}}} to A:
 
 {{{
 B.objects.all().order_by(a__name)
 }}}
 
 This means that all objects B with B.a==None will be missing. So, this
 should use an {{{OUTER JOIN}}}. I'm not sure whether this qualifies the
 patch as wrong, since the ORM fails to switch to OUTER joins in similar
 circumstances with, too.
 
 Michael

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