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
When using the sqlx CLI to run migrations on MariaDB, using variables in where statements results in a mixed collation error.
This does not occur if you run the sql queries "manually".
Using the minimal example below you will see: error: while executing migrations: error returned from database: 1267 (HY000): Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_unicode_ci,IMPLICIT) for operation '='
This can be resolved by forcing the collation to be utf8mb4_unicode_ci for the given statement.
Minimal Reproduction
Place these two files into ./migrations/ 1_collate_example.up.sql
Bug Description
When using the sqlx CLI to run migrations on MariaDB, using variables in where statements results in a mixed collation error.
This does not occur if you run the sql queries "manually".
Using the minimal example below you will see:
error: while executing migrations: error returned from database: 1267 (HY000): Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_unicode_ci,IMPLICIT) for operation '='
This can be resolved by forcing the collation to be utf8mb4_unicode_ci for the given statement.
Minimal Reproduction
Place these two files into
./migrations/
1_collate_example.up.sql
2_collate_example.up.sql
Assuming you have a mysql/MariaDB server setup with a user, the following will create and run our migrations.
export DATABASE_URL=mysql://zulzi:zulzi@localhost/collate-example sqlx database drop -y sqlx database create sqlx migrate run
A working example for 2_collate_example.up.sql would be
OR
Info
rustc --version
: rustc 1.77.1 (7cf61ebde 2024-03-27)The text was updated successfully, but these errors were encountered: