Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with update_all #7

Open
ghost opened this issue Jul 30, 2012 · 2 comments
Open

Issue with update_all #7

ghost opened this issue Jul 30, 2012 · 2 comments

Comments

@ghost
Copy link

ghost commented Jul 30, 2012

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

@kellydunn
Copy link

👍

@bdurand
Copy link
Owner

bdurand commented Jun 11, 2013

Can you capture the SQL generated with and without the gem installed from your development logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants