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

ActiveRecord MySQL bug? #120

Closed
agbodike opened this issue May 6, 2016 · 0 comments
Closed

ActiveRecord MySQL bug? #120

agbodike opened this issue May 6, 2016 · 0 comments

Comments

@agbodike
Copy link

agbodike commented May 6, 2016

I'm getting a SQL error in MySQL:

Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key FROM `flipper_features`' at line 1: SELECT key FROM `flipper_features`

I believe it's due to not putting backticks around key, which is a reserved word in mysql.

The issue does not happen in postgres

We are on an older version of rails (4.0)

Log output:

Started GET "/flipper" for 127.0.0.1 at 2016-05-05 16:46:07 -0700


Started GET "/flipper/features" for 127.0.0.1 at 2016-05-05 16:46:07 -0700
  Flipper::Adapters::ActiveRecord::Feature Load (0.5ms)  SELECT key FROM `flipper_features`
Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key FROM `flipper_features`' at line 1: SELECT key FROM `flipper_features`

ActiveRecord::StatementInvalid (Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key FROM `flipper_features`' at line 1: SELECT key FROM `flipper_features`):
  app/middleware/decompress_request.rb:16:in `call'


  Rendered .rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-4.0.13/lib/action_dispatch/middleware/templates/rescues/_source.erb (0.7ms)
  Rendered .rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-4.0.13/lib/action_dispatch/middleware/templates/rescues/_trace.erb (2.0ms)
  Rendered .rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-4.0.13/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.5ms)
  Rendered .rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-4.0.13/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (67.0ms)
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

1 participant