matrixorigin / matrixorigin/matrixone

[Bug]: Default collation is binary/case-sensitive; explicit _ci collations are ignored

Open
#25,096 9 comments 0 reactions 1 assignee Claimed by @iamlinjunhong View on GitHub
deferred kind/bug
Dominant language
Go
Stars
1.9k
Forks
311
Avg merge
1d 3h
Merged PRs (30d)
768

Description

### Is there an existing issue for the same bug?

- [X] I have checked the existing issues.

### Branch Name

v4.0.0-rc3

### Commit ID

8.0.30-MatrixOne-v4.0.0-rc3

### Other Environment Information

- Hardware parameters: N/A
- OS type: N/A
- Others: Reproduced via cross-language ORM compatibility testing (PHP / Python / Java / Node.js) over the MySQL 8.0.30 wire protocol. The minimal repro below uses raw SQL so it is driver-independent.

### Actual Behavior

New `VARCHAR`/`TEXT` columns default to `utf8mb4_bin` (`@@collation_server = utf8mb4_bin`), so all string comparisons are case- and accent-sensitive. Worse, requesting a `_ci` collation explicitly does **not** restore case-insensitivity — the collation is ignored.

```sql
SELECT 'abc' = 'ABC'; -- MatrixOne: 0
SELECT 'café' = 'cafe'; -- MatrixOne: 0
SELECT 'a ' = 'a'; -- MatrixOne: 0
SELECT 'abc' = 'ABC' COLLATE utf8mb4_general_ci; -- MatrixOne: 0 (collation ignored)
```

### Expected Behavior

MySQL 8's default is the case- and accent-**insensitive** `utf8mb4_0900_ai_ci`, and an explicitly requested `_ci` collation is honored:

```sql
SELECT 'abc' = 'ABC'; -- MySQL: 1
SELECT 'café' = 'cafe'; -- MySQL: 1
SELECT 'a ' = 'a'; -- MySQL: 1
SELECT 'abc' = 'ABC' COLLATE utf8mb4_general_ci; -- MySQL: 1
```

### Steps to Reproduce

```sql
CREATE TABLE t (c VARCHAR(20) COLLATE utf8mb4_general_ci);
INSERT INTO t VALUES ('abc');
SELECT COUNT(*) FROM t WHERE c = 'ABC'; -- MySQL: 1 MatrixOne: 0
```

### Additional information

**Impact:** silently breaks case-insensitive lookups, `UNIQUE` de-duplication, and logins for any application ported from MySQL. The usual workaround (specify a `_ci` collation) does not work; only `LOWER()`/`UPPER()` on both sides helps. This was the single biggest porting hazard and was reproduced in all four languages.

**Background:** dengn/php-tester#1, dengn/php-tester#4, dengn/php-tester#5, dengn/php-tester#6.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.