diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-12-19 18:39:10 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-12-19 18:58:25 +0900 |
commit | 1118e2c28913be29d03b8a119cb086fe15dacc39 (patch) | |
tree | f4bdf980e275dd3366d9c1bf6af5244b458e422a /activerecord/lib | |
parent | 67fefbe0c2de5d55b4d30958ce70d659c1c4cf35 (diff) | |
download | rails-1118e2c28913be29d03b8a119cb086fe15dacc39.tar.gz rails-1118e2c28913be29d03b8a119cb086fe15dacc39.tar.bz2 rails-1118e2c28913be29d03b8a119cb086fe15dacc39.zip |
Using subselect generated by the connection adapter for `update_all` with `offset`
Most RDBMS (except SQLite) requires subselect for UPDATE with OFFSET,
but Arel doesn't support executable subselect generation for MySQL's
UPDATE yet. We need to use the subselect generated by the connection
adapter for now, it works well.
Fixes #30148.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/relation.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index dd0d52ad1c..66fa98f172 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -317,7 +317,7 @@ module ActiveRecord stmt.set Arel.sql(@klass.sanitize_sql_for_assignment(updates)) stmt.table(table) - if has_join_values? + if has_join_values? || offset_value @klass.connection.join_to_update(stmt, arel, arel_attribute(primary_key)) else stmt.key = arel_attribute(primary_key) |