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

Make union/except/intersect chainable #519

Closed
wants to merge 1 commit into from

Conversation

fatkodima
Copy link
Member

Fixes #118.

This is an updated and changed/simplified version of #320.
The idea remains the same (SelectManager returns a new SelectManager on calls to union/intersect/except with, basically speaking, N-ary Union/Intersect/Excepts taking place of SelectCores inside SelectStatement).

TOP related code for SelectStatement was removed because it is basically a noop operation and will require implement also noop method for Union/.../... classes to work here

@ctx.top = Nodes::Top.new(limit)

Also, squashing braces in unions for MySQL was removed to allow applying limits and orders for individual queries. As stated in documentation:

To apply ORDER BY or LIMIT to an individual SELECT, place the clause inside the parentheses that enclose the SELECT.

Note: Previous versions of MySQL may permit such statements without parentheses. In MySQL 5.7, the requirement for parentheses is enforced.

But was introduced for SQLite, as it has troubles with parenthesized union subqueries and ordering + limits in them.

I'm also wondering, should all changed behavior be extensively deprecated or this PR can be merged in the next major version without any?

@rails-bot
Copy link

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @tenderlove (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@matthewd
Copy link
Member

Per #523, Arel development is moving to rails/rails.

If this PR is still relevant, please consider reopening it over there.

@matthewd matthewd closed this Apr 25, 2018
@fatkodima fatkodima deleted the joinable-union branch September 30, 2024 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants