← Back to Issue

Append TRADITIONAL instead of STRICT_ALL_TABLES to MySQL's sql_mode by default

From uloza+hey@proton.me · original ↗ · unsubscribe

On environments whose global sql_mode is empty — most notably Amazon RDS and Aurora MySQL default parameter groups — appending only STRICT_ALL_TABLES leaves out NO_ZERO_IN_DATE, NO_ZERO_DATE, and ERROR_FOR_DIVISION_BY_ZERO, which MySQL 5.7+ has otherwise made part of its own default. Appending TRADITIONAL closes the gap.


Append `TRADITIONAL` instead of `STRICT_ALL_TABLES` to MySQL’s `sql_mode` by default by kamipo · Pull Request #58350 · rails/rails · GitHub

Skip to content

Sign in

Appearance settings

Search/

Sign in

Sign up

Appearance settings

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert

Uh oh!

There was an error while loading. Please reload this page.

rails / rails Public

Additional navigation options

Append TRADITIONAL instead of STRICT_ALL_TABLES to MySQL’s sql_mode by default - #58350

#58350

Merged

kamipo merged 1 commit into

rails:mainrails/rails:mainfrom

kamipo:mysql_default_sql_mode_traditionalkamipo/rails:mysql_default_sql_mode_traditionalCopy head branch name to clipboard

Aug 9, 2026

ConversationCommits1 (1)ChecksFiles changed

Merged

##

Append TRADITIONAL instead of STRICT_ALL_TABLES to MySQL’s sql_mode by default#58350

kamipo merged 1 commit into

rails:mainrails/rails:mainfrom

kamipo:mysql_default_sql_mode_traditionalkamipo/rails:mysql_default_sql_mode_traditionalCopy head branch name to clipboard

Conversation

@kamipo

###

@kamipokamipo commented Aug 3, 2026

Copy link

Copy Markdown

Member

On environments whose global sql_mode is empty — most notably Amazon RDS and Aurora MySQL default parameter groups — appending only STRICT_ALL_TABLES leaves out NO_ZERO_IN_DATE, NO_ZERO_DATE, and ERROR_FOR_DIVISION_BY_ZERO, which MySQL 5.7+ has otherwise made part of its own default. Empty-sql_mode environments were expected to fade with MySQL 5.7+ adoption, but they haven’t.

As #57077 noted when deprecating the strict: false option, silently accepting invalid values is not a recommended default for modern applications. Appending TRADITIONAL closes the gap so the recommended behavior holds regardless of what sql_mode the server happens to default to.

Reproducing the previous behavior is possible via variables: { sql_mode: "STRICT_ALL_TABLES" } in database.yml.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions @github-actions github-actions Bot added the activerecord label Aug 3, 2026

@kamipo

[Append `TRADITIONAL` instead of `STRICT_ALL_TABLES` to MySQL's `sql_m…](/rails/rails/pull/58350/commits/64fb6b14419b2d4a2254889571554297fcba4c6f "Append `TRADITIONAL` instead of `STRICT_ALL_TABLES` to MySQL's `sql_mode` by default On environments whose global `sql_mode` is empty — most notably Amazon RDS and Aurora MySQL default parameter groups — appending only `STRICT_ALL_TABLES` leaves out `NO_ZERO_IN_DATE`, `NO_ZERO_DATE`, and `ERROR_FOR_DIVISION_BY_ZERO`, which MySQL 5.7+ has otherwise made part of its own default. Empty-`sql_mode` environments were expected to fade with MySQL 5.7+ adoption, but they haven't. As #57077 noted when deprecating the `strict: false` option, silently accepting invalid values is not a recommended default for modern applications. Appending `TRADITIONAL` closes the gap so the recommended behavior holds regardless of what `sql_mode` the server happens to default to. Reproducing the previous behavior is possible via `variables: { sql_mode: \"STRICT_ALL_TABLES\" }` in `database.yml`.") …

[64fb6b1](/rails/rails/pull/58350/commits/64fb6b14419b2d4a2254889571554297fcba4c6f)

…ode` by default

On environments whose global `sql_mode` is empty — most notably Amazon RDS and Aurora MySQL default parameter groups — appending only `STRICT_ALL_TABLES` leaves out `NO_ZERO_IN_DATE`, `NO_ZERO_DATE`, and `ERROR_FOR_DIVISION_BY_ZERO`, which MySQL 5.7+ has otherwise made part of its own default. Empty-`sql_mode` environments were expected to fade with MySQL 5.7+ adoption, but they haven’t.

As rails#57077 noted when deprecating the `strict: false` option, silently accepting invalid values is not a recommended default for modern applications. Appending `TRADITIONAL` closes the gap so the recommended behavior holds regardless of what `sql_mode` the server happens to default to.

Reproducing the previous behavior is possible via `variables: { sql_mode: “STRICT_ALL_TABLES” }` in `database.yml`.

@kamipo

kamipo force-pushed the mysql_default_sql_mode_traditional branch from d1ad843 to 64fb6b1 Compare August 9, 2026 10:37

Hide details View details

@kamipo

kamipo merged commit a24a698 into rails:main Aug 9, 2026

5 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@kamipo

kamipo deleted the mysql_default_sql_mode_traditional branch August 9, 2026 11:35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

### Reviewers

No reviews

Assignees

No one assigned

Labels

activerecord

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@kamipo

Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

© 2026 GitHub, Inc.

You can’t perform that action at this time.

Highlights & notes

    Notes