#14056: Wrong query generated when using reverse foreign key
---------------------------------------------------+------------------------
          Reporter:  premalshah                    |         Owner:  nobody     
            Status:  new                           |     Milestone:  1.3        
         Component:  Database layer (models, ORM)  |       Version:  1.0        
        Resolution:                                |      Keywords:  foreign key
             Stage:  Accepted                      |     Has_patch:  0          
        Needs_docs:  0                             |   Needs_tests:  0          
Needs_better_patch:  0                             |  
---------------------------------------------------+------------------------
Changes (by russellm):

  * stage:  Unreviewed => Accepted

Comment:

 Regarding query 1 -- the join *is* required, but it's being incorrectly
 optimized. This optimization is only valid when it is known that child IDs
 will shadow parent IDs. This will always happen for model inheritance, but
 that isn't what is happening in the sample models.

 The remaining queries all seem to be consequences of the same thing. Fix
 Q1, and the rest should follow.

 Although it doesn't look like it on first inspection, I suspect this may
 be closely related to #11319.

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