Changes between Initial Version and Version 1 of Ticket #20528, comment 1
- Timestamp:
- Jun 10, 2013, 10:25:17 AM (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #20528, comment 1
initial v1 1 1 The regression is caused by trimmed join. The OR condition would promote the join to LEFT OUTER, but the join is already trimmed so it isn't seen when the promotion happens. Then select_related adds a join to the same model and there pre-exists an INNER JOIN. That gets reused and the result is failure. 2 2 3 There are two obvious ways to fix this, first is: https://github.com/akaariai/django/commit/62b1d93d638ae05312af77775c96bdd602f075a5 - that is when Query.join(outer_if_first=True) is used, then aliases which exists but have refcount of 0 are promoted. The alternate is to promote the joins in ORed queries even for trimmed joins. 3 There are two obvious ways to fix this, first is: https://github.com/akaariai/django/commit/62b1d93d638ae05312af77775c96bdd602f075a5 - that is when Query.join(outer_if_first=True) is used, then aliases which exists but have refcount of 0 are promoted. The alternate is to promote the joins in ORed queries even for trimmed joins. EDIT: https://github.com/akaariai/django/compare/ticket_20528 for the alternate approach 4 4 5 5 Both approaches lead to test failures. The failures aren't critical, the queries will produce correct results but the join types aren't as efficient as possible.