id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux 17886,LOUTER join not promoted across filter expression,milosu,nobody,"In my database I have a little bit complicated relations. The attached test case fails without applied patch. The core of the problem is actually something like: {{{ ModelA <-- ModelB ---0--> Model C --> Model D <--0--> Model C --> Model D }}} When I put ModelA into django.contrib.admin changelist and try to search - the search fields containing fields from all above outlined models, the resulting queryset contains one INNER JOIN for the link between the second relation of Model C and Model D which removes from the result set those models for which the many2many link is empty - which I guess should not happen. I think that the LEFT OUTER JOIN should propagage in this case across relations. Maybe this patch solves also other ORM OR-queries related problems present or already patched earlier.. The attached patch solves this problem and I hope it passes the whole Django test suite - although due to the time limitations I tried it only with ""queries"" and ""aggregation_regress tests"". With this patch I was running my app in production for 2 years now, so I expect it *should* work. This bug was present in the Django ORM since the qs refactor branch was merged a few years ago so I think it does not need to be marked as 1.4 release bloker. But anyway.. ",Bug,closed,"Database layer (models, ORM)",1.4-beta-1,Normal,fixed,,,Ready for checkin,1,0,0,0,0,0