#16715: Wrong JOIN with nested null-able foreign keys -------------------------------------+------------------------------------- Reporter: sebastian | Owner: nobody Type: Bug | Status: new Milestone: | Component: Database layer Version: SVN | (models, ORM) Resolution: | Severity: Normal Triage Stage: Accepted | Keywords: join, values, Needs documentation: 0 | nested, foreign key, null-able Patch needs improvement: 1 | Has patch: 1 UI/UX: 0 | Needs tests: 1 | Easy pickings: 0 -------------------------------------+-------------------------------------
Comment (by sebastian): Thank you both for your feedback. I agree with Alex that the patch is most probably not in the right place, but again I am still not familiar enough with the Django internals to have the slightest idea what is happening here and what would be the appropriate place for fixing this bug. For the time being, I'll try to come up with some tests similar to the example in my original report and comment:2. '''@carljm:''' \\ Regarding a demonstration of where this bug causes a real problem in my code, see comment:2. That example is a simplified version of what I have for my current project (including multi-table inheritance Event→Screening). I wanted to use `select_related` in a schedule of all upcoming events, so that I don't have to fetch the movie information for all screenings in the template, but I ended up having all non-screening events missing in the resulting queryset. This is not the behavior I expected and this means that I cannot use `select_related`. Without that, an additional query is issued for each screening where I want to retrieve the movie information (instead of only a single query for everything). I tried to work around this with `values` and noticed that this also doesn't work, as illustrated by my original report (`values` even fails without using multi-table inheritance, using only simple foreign key relations!). -- Ticket URL: <https://code.djangoproject.com/ticket/16715#comment:7> Django <https://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.