1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #19359 from yahonda/mysql_subclient

Materialize subqueries by adding `DISTINCT` to suport MySQL 5.7.6 and later
This commit is contained in:
Rafael Mendonça França 2015-03-16 19:10:37 -03:00
commit 8f3bd3db49

View file

@ -785,7 +785,9 @@ module ActiveRecord
subselect = Arel::SelectManager.new(select.engine) subselect = Arel::SelectManager.new(select.engine)
subselect.project Arel.sql(key.name) subselect.project Arel.sql(key.name)
subselect.from subsubselect.as('__active_record_temp') # Materialized subquery by adding distinct
# to work with MySQL 5.7.6 which sets optimizer_switch='derived_merge=on'
subselect.from subsubselect.distinct.as('__active_record_temp')
end end
def add_index_length(option_strings, column_names, options = {}) def add_index_length(option_strings, column_names, options = {})