aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-12-19 18:39:10 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-12-19 18:58:25 +0900
commit1118e2c28913be29d03b8a119cb086fe15dacc39 (patch)
treef4bdf980e275dd3366d9c1bf6af5244b458e422a /activerecord/lib/active_record/relation.rb
parent67fefbe0c2de5d55b4d30958ce70d659c1c4cf35 (diff)
downloadrails-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/active_record/relation.rb')
-rw-r--r--activerecord/lib/active_record/relation.rb2
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)