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
{{ message }}
Repository navigation
[Bug]: LIKE underscore wildcard does not match one multibyte utf8mb4 character #27389
For utf8mb4 strings, MatrixOne evaluates the SQL LIKE underscore wildcard byte-wise (or ASCII-only) instead of character-wise. A one-character Chinese, emoji, or accented string does not match _, while a one-character ASCII string does.
This is visible through MatrixOne ODBC and reproduces identically with a direct MySQL CLI, so it is a server issue rather than an ODBC conversion issue.
Versions and environment
MatrixOne commit: 592ad2190a90e063e3877059f4018427a10a4998 (latest main tested on 2026-08-20)
Installed preview driver used by pyodbc: MatrixOne ODBC 9.7 Unicode Driver, file version 9.7.0.0 (v9.7.0-mo.3)
OS: Windows 11 x64 client; Ubuntu 24.04 under WSL2 server
Clients: Python 3.12.13 + pyodbc 5.3.0; direct MySQL 9.7.1 CLI
Minimal reproduction
createdatabaseif not exists odbc_like_repro;
use odbc_like_repro;
droptable if exists t;
createtablet(id intprimary key, v varchar(40));
insert into t values
(1,'🙂'),
(2,'中'),
(3,'é'),
(4,'A');
select id,v,hex(v),char_length(v) from t order by id;
select id from t where v like'_'order by id;
The ODBC scenario executes the same predicate through SQLExecDirectW; no client-side wildcard expansion is involved.
Actual result
CHAR_LENGTH(v) is 1 for all four rows, but LIKE '_' returns only:
id
4
The same test also confirmed that LIKE ... ESCAPE works for literal _ and %, so the failure is specific to wildcard character width.
Expected result
The query should return ids 1,2,3,4. MySQL defines _ as matching one character, and these are all one-character utf8mb4 strings.
Direct SQL: server-candidate-repros-round3.sql, marker UNICODE_LIKE
Direct result: direct-mysql-candidate-repros-round3.log
Workaround
For a predicate consisting only of _ wildcards, an application can use CHAR_LENGTH(v) = n. There is no straightforward equivalent workaround for general mixed %/_ patterns without rewriting the match logic.
Activity
fix: match LIKE underscore by UTF-8 character (#27506)
fix: match LIKE underscore by UTF-8 character (matrixorigin#27506)
fix: match LIKE underscore by UTF-8 character (matrixorigin#27506)
fix: match LIKE underscore by UTF-8 character (matrixorigin#27506)