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:
commit
8f3bd3db49
1 changed files with 3 additions and 1 deletions
|
@ -785,7 +785,9 @@ module ActiveRecord
|
|||
|
||||
subselect = Arel::SelectManager.new(select.engine)
|
||||
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
|
||||
|
||||
def add_index_length(option_strings, column_names, options = {})
|
||||
|
|
Loading…
Reference in a new issue