Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default to OUTER JOIN for Table, KeyValue backends #277

Merged
merged 1 commit into from
Sep 20, 2018

Conversation

shioyama
Copy link
Owner

Currently we default to an INNER join for the Table and KeyValue backends, although this never has any impact when using where since we always have equality predicates which don't fall through to the default. But for order, we currently use INNER join, which means that:

Post.i18n.order(:title)

will only return posts that have a non-NULL title column. This seems counter-intuitive to me, so I'm changing the behaviour to use an OUTER join here so that all posts will be returned, even if they do not have a translation (in this case title will be ordered as if it was nil).

I also found a small bug where && was returning false instead of nil, fixed here.

@shioyama shioyama force-pushed the join_translations_default_outer_join branch from 61ffe94 to 20fd538 Compare September 20, 2018 09:32
@shioyama shioyama force-pushed the join_translations_default_outer_join branch from 20fd538 to 88bd59d Compare September 20, 2018 10:06
@shioyama shioyama merged commit 88bd59d into master Sep 20, 2018
@shioyama shioyama deleted the join_translations_default_outer_join branch September 20, 2018 11:06
shioyama added a commit that referenced this pull request Sep 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant