#4789: select_related + depth gives wrong result
---------------------------------------------------+------------------------
   Reporter:  Gábor Farkas <[EMAIL PROTECTED]>  |                Owner:  adrian 
         
     Status:  new                                  |            Component:  
Database wrapper
    Version:  SVN                                  |           Resolution:      
            
   Keywords:  select_related, depth                |                Stage:  
Unreviewed      
  Has_patch:  1                                    |           Needs_docs:  0   
            
Needs_tests:  0                                    |   Needs_better_patch:  0   
            
---------------------------------------------------+------------------------
Changes (by Gábor Farkas <[EMAIL PROTECTED]>):

  * has_patch:  0 => 1

Comment:

 i added a patch that fixes the problem. the patch also adds additional
 tests to the select-related test.
 
 the problem was that django, when constructing the SQL query recursively,
 went one level too deep.
 
 so the sql-rows had more entries than django awaited,
 so he constructed the django-objects using the incorrect data.
 
 the reason why the testcases did not catch the bug was
 that the testcase dealt only with a single "chain" of relations.
 
 so even when the sql query contained too many fields,
 the "wrong" part was never used.
 
 but i modified the tests, so that the main object
 has 2 foreignkeys now, so the problem is triggered.

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