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

Fix: Arel now emits a single pair of parens for UNION and UNION ALL #34437

Merged
merged 1 commit into from Nov 13, 2018

Conversation

kbrock
Copy link
Contributor

@kbrock kbrock commented Nov 13, 2018

Multiple union all statement generates extra parens. This is not valid SQL and causes sqlite to throw an error (and possibly others).

Mysql has a great implementation to suppress multiple parens for UNION sql statements.

This PR shares the UNION implementation with UNION ALL and also shares the implementation
with the other database implementations.

This PR is moved from rails/arel#510 - which was addressing 4 issues over there.

Thanks all

@rails-bot
Copy link

r? @schneems

(@rails-bot has picked a reviewer for you, use r? to override)

mysql has a great implementation to suppress multiple parens for union
sql statements.

This moves that functionality to the generic implementation
This also introduces that functionality for UNION ALL
@rafaelfranca
Copy link
Member

Thank you. Merged in 3dea7f0

@rafaelfranca rafaelfranca merged commit 63dd8d8 into rails:master Nov 13, 2018
rafaelfranca added a commit that referenced this pull request Nov 13, 2018
Fix: Arel now emits a single pair of parens for UNION and UNION ALL
@kbrock kbrock deleted the union_all_paren branch November 14, 2018 12:36
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.

None yet

4 participants