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
If specify strict: :default
explicitly, do not set sql_mode.
#17654
Conversation
@@ -810,7 +810,7 @@ def configure_connection | |||
# Make MySQL reject illegal values rather than truncating or blanking them, see | |||
# http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html#sqlmode_strict_all_tables | |||
# If the user has provided another value for sql_mode, don't replace it. | |||
unless variables.has_key?('sql_mode') | |||
if @config.has_key?(:strict) && !variables.has_key?('sql_mode') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps check for if @config[:strict]
? What if someone passes strict: false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, we should allow the user to pass in strict: false
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the next line is variables['sql_mode'] = strict_mode? ? 'STRICT_ALL_TABLES' : ''
,
when strict: true
it becomes variables['sql_mode'] = 'STRICT_ALL_TABLES'
,
when strict: false
it becomes variables['sql_mode'] = ''
.
One comment, this seems fine otherwise. |
IIUC, this changes the default behaviour so that we no longer default to strict mode. That seems not okay, and even if we do think it's a good idea, it would be 5.0 material. |
Indeed, this changes the default behaviour so that we no longer default to strict mode. However, strict_mode should be specified explicitly rather than implicit default. This is because, if MySQL settings are being carried out properly by the administrator, the application should not overwrite the sql_mode. In practice, I had that do not set the sql_mode by |
It does not change the default behavior by kamipo@a7df5af. How does if this? |
a7df5af
to
7961f4f
Compare
strict: :default
explicitly, do not set sql_mode.
3b3edb8
to
7961f4f
Compare
I squashed this PR. This PR is no longer change the default behavior. |
If specify `strict: :default` explicitly, do not set sql_mode.
I believe this needs a CHANGELOG entry, something like this would be very helpful to understand how it works! :) |
Add CHANGELOG entry for #17654
Should this be backported? |
Is there any workaround? If so it is better to not backport. |
Related with #17370.