Skip to content

breaking(mysql): assume all non-binary collations compatible with str #3924

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

Merged
merged 1 commit into from
Jul 8, 2025

Conversation

abonander
Copy link
Collaborator

@abonander abonander commented Jul 6, 2025

cc #3400 (comment)

comment in sqlx-mysql/src/collation.rs for explanation

fixes #3200
fixes #3387
fixes #3390
fixes #3409

Breaking Changes

  • Text (or text-like) columns which previously were inferred to be Vec<u8> will be inferred to be String (this should ultimately fix more code than it breaks).
  • SET NAMES utf8mb4 COLLATE utf8_general_ci is no longer sent by default; instead, SET NAMES utf8mb4 is sent to
    allow the server to select the appropriate default collation (since this is version- and configuration-dependent).
  • MySqlConnectOptions::charset() and ::collation() now imply ::set_names(true) because they don't do anything otherwise.
  • Setting charset doesn't change what's sent in the Protocol::HandshakeResponse41 packet as that normally only matters for error messages before SET NAMES is sent. The default collation if set_names = false is utf8mb4_general_ci.
  • RawSql::fetch_optional() now returns sqlx::Result<Option<DB::Row>> instead of sqlx::Result<DB::Row>. Whoops.

@abonander abonander added this to the 0.9.0 milestone Jul 6, 2025
@abonander abonander added db:mysql Related to MySQL breaking labels Jul 6, 2025
@abonander abonander force-pushed the ab/mysql-collation branch 12 times, most recently from efdb88c to 9a8135c Compare July 7, 2025 01:04
cc #3400 (comment)

comment in `sqlx-mysql/src/collation.rs` for explanation

fixes #3200
fixes #3387
fixes #3390
fixes #3409
@abonander abonander force-pushed the ab/mysql-collation branch from 9a8135c to dc0ad82 Compare July 7, 2025 01:11
@abonander abonander merged commit a3aa942 into main Jul 8, 2025
92 checks passed
@abonander abonander deleted the ab/mysql-collation branch July 8, 2025 07:39
kriswuollett pushed a commit to kriswuollett/sqlx that referenced this pull request Jul 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking db:mysql Related to MySQL
Projects
None yet
1 participant