matrixorigin / matrixorigin/matrixone
[Bug]: explicit collation conflicts are not rejected like MySQL
- Dominant language
- Go
- Stars
- 1.9k
- Forks
- 311
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 768
Description
## Bug Report
### Description
MatrixOne does not reject expressions that mix two explicit but different collations. MySQL raises `ERROR 1267 Illegal mix of collations`, while MatrixOne evaluates the expression and returns a result.
This is related to the broader collation semantic gap in #25239, but this issue tracks a separate unhappy path: MySQL-compatible collation conflict errors are not raised.
### Steps to Reproduce
```sql
select _utf8mb4'a' collate utf8mb4_bin = _utf8mb4'a' collate utf8mb4_general_ci as mixed_explicit_eq;
select concat(_utf8mb4'a' collate utf8mb4_bin,
_utf8mb4'b' collate utf8mb4_general_ci) as mixed_explicit_concat;
select case when 1
then _utf8mb4'a' collate utf8mb4_bin
else _utf8mb4'b' collate utf8mb4_general_ci
end as mixed_explicit_case;
select coalesce(_utf8mb4'a' collate utf8mb4_bin,
_utf8mb4'b' collate utf8mb4_general_ci) as mixed_explicit_coalesce;
select least(_utf8mb4'a' collate utf8mb4_bin,
_utf8mb4'b' collate utf8mb4_general_ci) as mixed_explicit_least;
```
### MySQL Result
MySQL rejects these statements with `ERROR 1267`, for example:
```text
ERROR 1267 (HY000): Illegal mix of collations (utf8mb4_bin,EXPLICIT) and (utf8mb4_general_ci,EXPLICIT) for operation '='
ERROR 1267 (HY000): Illegal mix of collations (utf8mb4_bin,EXPLICIT) and (utf8mb4_general_ci,EXPLICIT) for operation 'concat'
ERROR 1267 (HY000): Illegal mix of collations (utf8mb4_bin,EXPLICIT) and (utf8mb4_general_ci,EXPLICIT) for operation 'case'
ERROR 1267 (HY000): Illegal mix of collations (utf8mb4_bin,EXPLICIT) and (utf8mb4_general_ci,EXPLICIT) for operation 'coalesce'
ERROR 1267 (HY000): Illegal mix of collations (utf8mb4_bin,EXPLICIT) and (utf8mb4_general_ci,EXPLICIT) for operation 'least'
```
### MatrixOne Result
Tested on latest `main` at `200bfa7e0efb`.
```text
mixed_explicit_eq
1
mixed_explicit_concat
ab
mixed_explicit_case
a
mixed_explicit_coalesce
a
mixed_explicit_least
a
```
### Expected Behavior
MatrixOne should reject incompatible explicit collation mixes with a MySQL-compatible error.
### Notes
Found during active MySQL compatibility exploration, Module 4: String / Charset / Collation. I searched existing issues for `Illegal mix of collations` and explicit collation conflicts and did not find a duplicate.
Contributor guide
Assessment
This issue has not been assessed yet.