#10733: Invalid results when deferring fields in more than one related model 
with
only()
---------------------------------------------------+------------------------
          Reporter:  mrts                          |         Owner:  nobody     
    
            Status:  reopened                      |     Milestone:  1.2        
    
         Component:  Database layer (models, ORM)  |       Version:  SVN        
    
        Resolution:                                |      Keywords:  
efficient-admin
             Stage:  Accepted                      |     Has_patch:  1          
    
        Needs_docs:  0                             |   Needs_tests:  0          
    
Needs_better_patch:  1                             |  
---------------------------------------------------+------------------------
Comment (by mrts):

 Right you are, `select_related('a', 'b').query.as_sql()` looks correct:
 {{{
 >>> C.objects.all().only('name', 'a', 'b', 'a__name',
 'b__name').select_related('a', 'b').query.as_sql()
 ('SELECT "only_breakage_c"."id", "only_breakage_c"."name",
 "only_breakage_c"."a_id", "only_breakage_c"."b_id",
 "only_breakage_a"."id", "only_breakage_a"."name",
 "only_breakage_b"."id", "only_breakage_b"."name"
 FROM "only_breakage_c"
 LEFT OUTER JOIN "only_breakage_a" ON ("only_breakage_c"."a_id" =
 "only_breakage_a"."id")
 INNER JOIN "only_breakage_b" ON ("only_breakage_c"."b_id" =
 "only_breakage_b"."id")',
  ())
 }}}

 Doesn't affect the behaviour though, problems 1-3 remain.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/10733#comment:16>
Django <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 django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to