Repository navigation
Description
DRAFT ISSUE 17 (候选, 不要提交)
标题候选: [Bug]: quoted '0x..' / '0b..' strings parse as hex/binary literals — MySQL treats them as plain strings (numeric prefix 0)
标签: kind/bug, needs-triage
Description
MatrixOne applies hex/binary literal interpretation to quoted strings. MySQL only interprets 0x../0b.. as numeric literals when unquoted; a quoted '0x10' is a plain VARCHAR whose numeric value is the prefix 0.
| Expression | MO (main, 2026-10-26) | MySQL 8.0.45 |
|---|---|---|
SELECT '0xff' + 0 |
255 | 0 |
SELECT '0x10' + 0 |
16 | 0 |
SELECT '0xA' = 10 |
1 | 0 |
SELECT '0b101' + 0 |
5 | 0 |
SELECT '0b101' = 5 |
1 | 0 |
SELECT '0x10' = 16 |
1 | 0 |
SELECT 0xff + 0 (unquoted) |
255 | 255 ✓ (both agree) |
SELECT 0x41 = 'A' |
1 | 1 ✓ |
SELECT x'41' |
A |
A ✓ |
Note 0z' + 0 errors on MO (strict path — already-known separate family) while MySQL gives 0, so the hex interpretation is not just "lenient parsing" — it's a distinct hex/binary detection rule applied to quoted strings.
Reproduction
SELECT '0xff' + 0; -- MO: 255. MySQL: 0
SELECT '0b101' = 5; -- MO: 1. MySQL: 0Impact
- Silent wrong answers for any string column that stores hex-looking data (device IDs, MD5 prefixes like
'0a1b...', config values'0b*').WHERE hex_id = 16matches'0x10'rows on MatrixOne that MySQL would never match; arithmetic over such columns (SUM(hexcol)) produces inflated numbers instead of MySQL's prefix-based values. - Migration divergence is silent: queries that aggregate or compare hex-looking strings return different results with no error, the worst class of incompatibility.
- Security-adjacent: shell-bracket style filters like
WHERE token = '0x4141'behave differently between engines during credential or hash lookups.
Expected behavior
Quoted strings must coerce numerically via the decimal numeric prefix like any other string (so '0xff' → 0, '0b101' → 0), matching MySQL. Reserve hex/binary literal interpretation for the unquoted 0x../0b.. token forms and X'..'/B'..' literals, which already behave correctly.
Activity
XuPeng-SH commentedon Nov 30, 2026
Closing as duplicate of #25265.
Both reports cover quoted
'0x..'/'0b..'strings being interpreted as radix values instead of MySQL ordinary strings. The arithmetic, comparison, and unquoted-literal control cases are retained on #25265.Administrative consolidation only; this does not mean the conversion behavior is fixed or QA-verified.