Skip to content

[Bug]: invalid UTF-8 bytes can be inserted into utf8mb4 varchar #25302

Open

Description

@Ariznawlll

Bug Report

Description

MatrixOne accepts invalid UTF-8 byte sequences into a utf8mb4 VARCHAR column. MySQL rejects the same insert with ERROR 1366 Incorrect string value.

Steps to Reproduce

drop table if exists t_invalid_utf8_probe;

create table t_invalid_utf8_probe (
  id int primary key,
  s varchar(10) character set utf8mb4,
  b varbinary(10)
);

insert into t_invalid_utf8_probe values (1, unhex('C328'), unhex('C328'));

select id, hex(s) as s_hex, hex(b) as b_hex
from t_invalid_utf8_probe
order by id;

MySQL Result

ERROR 1366 (HY000): Incorrect string value: '\xC3(' for column 's' at row 1

No row is inserted.

MatrixOne Result

Tested on latest main at 200bfa7e0efb.

id  s_hex  b_hex
1   C328   C328

Expected Behavior

For utf8mb4 text columns, MatrixOne should reject invalid UTF-8 byte sequences, matching MySQL. Binary columns such as VARBINARY may store the raw bytes.

Notes

Found during active MySQL compatibility exploration, Module 4: String / Charset / Collation. I searched existing issues for invalid UTF-8 insert / incorrect string value and did not find a duplicate.

Activity

  1. added
    kind/bug
    severity/s1
    on Jul 1, 2026
  2. added
    severity/s0
    and removed
    severity/s1
    on Jul 2, 2026
  3. added this to the MO-202607 milestone on Jul 2, 2026
  4. added theissue type on Jul 2, 2026
  5. added and removed
    severity/s0
    on Jul 2, 2026
  6. added
    ai-medium
    on Jul 3, 2026
  7. daviszhen commented on Aug 5, 2026

    @daviszhen
    Contributor

    彻底修改,修改量太大

    image image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ai-mediumdeferredkind/bug

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions