Repository navigation
Description
Bug or Feature Request
Bug
Description
Comparing a string containing a decimal point or exponent against an integer literal raises a hard cast error instead of comparing — MySQL compares both sides as DOUBLE and returns a boolean:
| expression | MatrixOne (v3.x @ b24d1b3) | MySQL 8 |
|---|---|---|
'10' = 10 |
1 ✓ | 1 |
' 10' = 10 |
1 ✓ | 1 |
'10.0' = 10 |
ERROR 20203: invalid argument cast to int, bad value 10.0 | 1 |
'1e1' = 10 |
ERROR 20203: invalid argument cast to int, bad value 1e1 | 1 |
'10.5' = 10.5 |
1 ✓ (works because RHS is float) | 1 |
'1e1' = 10.0 |
1 ✓ (works because RHS is float) | 1 |
The raise-vs-compare outcome depends solely on whether the right-hand literal parses as int or as double — an invisible internal typing detail to the user. MySQL's documented behavior for str = number is a single rule: convert the string to DOUBLE, compare numerically (non-numeric strings compare as ~0 with no error in non-strict contexts; well-formed decimals like '10.0' simply equal).
Real-world blast radius:
- Any ORM / templating / dynamic-SQL layer that binds a string-typed value against an integer parameter collapses from "match/no match" to a query-killing runtime error:
WHERE bucket = '1e3'(string from JSON config),WHERE amount = '10.0'(string from a form field),in ('1.0','2.0')lists containing formatted numbers. - Exponent notation
'1e1'is whatfloat.to_string()-style serializers emit — a common accidental parameter format. - Note
' 10'(leading space) parses fine while'10.0'explodes — the acceptance set is narrower than every mainstream client convention.
Same failure occurs inside WHERE clauses and SELECT projections alike (independent of plan position), e.g.:
SELECT col_v = 10 FROM (SELECT '10.0' AS col_v) t WHERE col_v = 10;
-- ERROR 20203 (HY000): invalid argument cast to int, bad value 10.0Steps to Reproduce
v3.x @ b24d1b3, macOS arm64, single-node:
SELECT '10.0' = 10;
-- ERROR 20203 (HY000): invalid argument cast to int, bad value 10.0
SELECT '1e1' = 10;
-- ERROR 20203 (HY000): invalid argument cast to int, bad value 1e1
-- controls:
SELECT '10.0' = 10.0; -- 1 (works: RHS is float)
SELECT '1e1' = 10.0; -- 1 (works: RHS is float)
SELECT '10' = 10; -- 1 (works: pure-integer string)Expected behavior
Per MySQL semantics, string = number comparisons convert the string operand to DOUBLE once and compare numerically: '10.0' = 10 → 1, '1e1' = 10 → 1. The int-cast path must not be used for cross-type comparison just because the RHS literal happens to be integral-typed.
Versions
- MatrixOne commit
b24d1b3(2026-10-16), v3.x dev, macOS arm64
Additional context
- Also verified related strictness divergence for completeness:
SELECT CAST('abc' AS SIGNED)errors in MatrixOne but yields 0 with a warning in MySQL non-strict / classic mode — that part is arguably intentional modern strictness (and matches MySQL strict mode's 1292), so this issue is scoped to the comparison-operator typing rule, which deviates from MySQL in all modes.
Activity
XuPeng-SH commentedon Oct 22, 2026
合并跟踪到 #30730。此 issue 的关键复现('10.0' = 10、'1e1' = 10 在整数路径报 cast error)已补入主 issue 的行为矩阵;保留的目标是统一不同操作符和 SQL mode 下的隐式字符串转数值策略。