Skip to content

Fix merging left_joins to maintain its own join_type context#36120

Merged
kamipo merged 1 commit intorails:masterfrom
kamipo:should_maintain_join_type
Apr 27, 2019
Merged

Fix merging left_joins to maintain its own join_type context#36120
kamipo merged 1 commit intorails:masterfrom
kamipo:should_maintain_join_type

Conversation

@kamipo
Copy link
Copy Markdown
Member

@kamipo kamipo commented Apr 27, 2019

This fixes a regression for #35864.

Usually, stashed joins (mainly eager loading) are performed as LEFT
JOINs.
But the case of merging joins/left_joins of different class, that
(stashed) joins are performed as the same join_type as the parent
context for now.
Since #35864, both (joins/left_joins) stashed joins might be contained
in joins_values, so each stashed joins should maintain its own
join_type context.

Fixes #36103.

This fixes a regression for rails#35864.

Usually, stashed joins (mainly eager loading) are performed as LEFT
JOINs.
But the case of merging joins/left_joins of different class, that
(stashed) joins are performed as the same `join_type` as the parent
context for now.
Since rails#35864, both (joins/left_joins) stashed joins might be contained
in `joins_values`, so each stashed joins should maintain its own
`join_type` context.

Fixes rails#36103.
@kamipo kamipo merged commit 99df469 into rails:master Apr 27, 2019
@kamipo kamipo deleted the should_maintain_join_type branch April 27, 2019 14:26
kamipo added a commit that referenced this pull request Apr 27, 2019
Fix merging left_joins to maintain its own `join_type` context
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6.0.0.rc1: ActiveRecord builds a query using INNER JOIN instead of LEFT OUTER JOIN

1 participant