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

variables hash of database yaml is not symbolized #14895

Closed
GhostGambler opened this Issue Apr 28, 2014 · 4 comments

Comments

Projects
None yet
4 participants
@GhostGambler
Copy link

commented Apr 28, 2014

Concerning
61b528e

Example file

production:
  adapter: mysql2
  username: xxx
  password: xxx
  database: aod
  pool: 5
  timeout: 5000
  encoding: utf8
  variables:
    sql_mode: 'ansi'

is loaded as

:variables=>{"sql_mode"=>"ansi", :sql_auto_is_null=>0, :wait_timeout=>2147483, :sql_mode=>"STRICT_ALL_TABLES"}

This makes no sense. The sql_mode=STRICT_ALL_TABLES should be replaced by my specific setting, which would work (see the if 61b528e#diff-98ce5dc0cd01f8b0435ff6feac10d8a8R723) if the keys of the yaml were symbolized. They are not, and I'd call that a bug.

@pftg

This comment has been minimized.

Copy link
Contributor

commented Apr 28, 2014

@GhostGambler please review PR, is it helpful for you?

@pftg

This comment has been minimized.

Copy link
Contributor

commented Apr 28, 2014

@schneems

This comment has been minimized.

Copy link
Member

commented Apr 28, 2014

In postgres i'm pretty sure all keys are actually strings: https://devcenter.heroku.com/articles/concurrency-and-database-connections#bad-connections

Notice that we're modifying config['pool'] and not config[:pool]. Is this behavior different for all connection adapters?

@jeremy

This comment has been minimized.

Copy link
Member

commented Apr 28, 2014

@schneems - This is specific to mysql :variables hash handling

Moving to #14896.

@jeremy jeremy closed this Apr 28, 2014

pftg added a commit to jetthoughts/rails that referenced this issue Apr 30, 2014

Stringify variables names for mysql connections
For mysql2/mysql adapters, `sql_mode` variable name set in `database.yml`
as string, was ignored and `sql_mode` was set to use strict mode.

Fixes rails#14895
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.