On May 23, 11:33 pm, akaariai <akaar...@gmail.com> wrote: > On May 23, 3:36 pm, akaariai <akaar...@gmail.com> wrote: > > > I guess (again!) that the reason for the LEFT JOIN is this call in sql/ > > compiler.py:_setup_joins() > > > self.query.promote_alias_chain(joins, > > self.query.alias_map[joins[0]].join_type == self.query.LOUTER) > > > This seems to promote the join to outer join too aggressively, the > > promote_alias_chain call does not see that the join is constrained by > > other conditions already. I don't know if this has any practical > > effects, nor do I know how easy/hard this would be to fix. It could be > > as easy as just starting from the first new join generated by the > > _setup_joins() call, and leaving the pre-existing joins alone. If it > > is that easy, it should be fixed... > > I have a fix for the issue mentioned above. I haven't figured out how > to create a query where promotion from INNER JOIN to LEFT OUTER JOIN > will cause wrong results. Fixing this is still worth it, as even if > there isn't a query where the current promotion logic breaks the > results, it is possible there one day will be a way to do that. There > might be performance impacts at least for some databases. > > If somebody happens to figure out a query which produces wrong results > due to the INNER -> OUTER promotion it would be good to add a test > case for that. > > See this pull request for details:https://github.com/django/django/pull/90 > > - Anssi
Fixed in https://github.com/django/django/commit/8c72aa237918e31a525022f72b22cac75451af86 - Anssi -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.