Skip to content

Issue with update_all #7

@ghost

Description

Hi,

I am facing problem while the executing below query

ModelName.update_all(["field_id = ?, updated_at = ?", 345, Time.now], ["field_id = 1"], :order => "id", :limit => 1)

Here is the exception I am getting

ActiveRecord::StatementInvalid: Mysql2::Error: This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery': ModelName.update_all(["field_id = ?, updated_at = ?", 345, Time.now], ["file_id = 0 "], :order => "id", :limit => 1)
   from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:207:in rescue in log'    from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/connection_adapters/abstract_adapter.rb:199:inlog'
   from /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6/lib/active_record/connection_adapters/mysql2_adapter.rb:314:in execute'    from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/connection_adapters/abstract/database_statements.rb:288:inupdate_sql'
   from /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6/lib/active_record/connection_adapters/mysql2_adapter.rb:331:in update_sql'    from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/connection_adapters/abstract/database_statements.rb:49:inupdate'
   from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/connection_adapters/abstract/query_cache.rb:16:in update'    from /usr/local/lib/ruby/gems/1.9.1/gems/seamless_database_pool-1.0.11/lib/active_record/connection_adapters/seamless_database_pool_adapter.rb:336:inproxy_connection_method'
   from /usr/local/lib/ruby/gems/1.9.1/gems/seamless_database_pool-1.0.11/lib/active_record/connection_adapters/seamless_database_pool_adapter.rb:122:in block in update'    from /usr/local/lib/ruby/gems/1.9.1/gems/seamless_database_pool-1.0.11/lib/active_record/connection_adapters/seamless_database_pool_adapter.rb:243:inuse_master_connection'
   from /usr/local/lib/ruby/gems/1.9.1/gems/seamless_database_pool-1.0.11/lib/active_record/connection_adapters/seamless_database_pool_adapter.rb:121:in update'    from /usr/local/lib/ruby/gems/1.9.1/gems/arel-2.0.9/lib/arel/crud.rb:20:inupdate'
   from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/relation.rb:159:in update_all'    from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/relation.rb:155:inupdate_all'
   from /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/lib/active_record/base.rb:439:in update_all'    from (irb):1    from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/rails/commands/console.rb:44:instart'
   from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/rails/commands/console.rb:8:in start'    from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/rails/commands.rb:23:in<top (required)>'
   from script/rails:6:in `require'

This query is working fine before I used seamless_database_pool gem.

Please let me know if there is any solution.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions