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]: integer + decimal string errors (1 + '2.5' → cast to int, MySQL returns 3.5) #30908
Arithmetic with an integer left operand and a decimal-literal string right operand fails: 1 + '2.5' raises ERROR 20203: invalid argument cast to int, bad value 2.5, whereas MySQL evaluates it as 3.5. The string '2.5' is coerced to an integer type when the other operand is an integer, instead of promoting to DOUBLE/DECIMAL as MySQL does.
Environment
MatrixOne dev build 3a1e42b430, server reports 8.0.30-MatrixOne-v1.3.0
MySQL comparison: 8.0.45 (localhost)
Reproduction
SELECT1+'2.5'; -- MatrixOne: ERROR 20203 (HY000) invalid argument cast to int, bad value 2.5-- MySQL: 3.5SELECT1-'0.5'; -- MatrixOne: ERROR 20203 ... bad value 0.5 ; MySQL: 0.5SELECT'2.5'+1; -- MatrixOne: ERROR 20203 ... bad value 2.5 ; MySQL: 3.5-- Controls that do work on MatrixOne (shows the bug is integer-operand-specific):SELECT1.0+'2.5'; -- 3.5 (double operand → correct)SELECT1+'2'; -- 3 (integer string → correct)
Root cause
When one operand of a binary arithmetic operator is an integer and the other is a string, MatrixOne infers the string's type as integer too (rather than double), so a decimal string such as '2.5' is fed into an int cast and rejected. MySQL's numeric-type coercion treats the string as a numeric (DOUBLE) here, matching the value's actual decimal form.
Impact
Legitimate arithmetic over string-typed values (common when columns are VARCHAR holding numbers, e.g. int_col + varchar_col with fractional values) errors out instead of computing.
Breaks expressions like SELECT qty + '1.5' used in ETL/BI over loosely-typed schemas, which MySQL handles transparently.
Expected behavior
1 + '2.5' should return 3.5 (promote to DOUBLE), consistent with MySQL and with 1.0 + '2.5'.
This reproduction is now tracked under #30730, which covers implicit string-to-number coercion changing with inferred integer versus DOUBLE paths. Its acceptance criteria now include the well-formed decimal-string arithmetic cases from this report (1 + '2.5', 1 - '0.5', and '2.5' + 1) alongside the existing malformed-string cases.
Closing this issue records tracking consolidation only. The reproduction and environment above remain available here; no fix is claimed.
Same root cause also affects comparison operators, not just arithmetic — worth covering in the fix:
SELECT1<'2.5'; -- ERROR 20203 cast to int, bad value 2.5 ; MySQL: 1SELECT1>'0.5'; -- ERROR 20203 ; MySQL: 1SELECT2<'2.1'; -- ERROR 20203 ; MySQL: 1
So the integer-operand + decimal-string coercion bug spans +, -, *, <, >, <=, >= — any operator whose binder locks the string to int when the other side is an integer. (The = case is tracked in #30694.)
Activity
XuPeng-SH commentedon Oct 23, 2026
This reproduction is now tracked under #30730, which covers implicit string-to-number coercion changing with inferred integer versus DOUBLE paths. Its acceptance criteria now include the well-formed decimal-string arithmetic cases from this report (
1 + '2.5',1 - '0.5', and'2.5' + 1) alongside the existing malformed-string cases.Closing this issue records tracking consolidation only. The reproduction and environment above remain available here; no fix is claimed.
Ariznawlll commentedon Oct 23, 2026
Same root cause also affects comparison operators, not just arithmetic — worth covering in the fix:
So the integer-operand + decimal-string coercion bug spans
+,-,*,<,>,<=,>=— any operator whose binder locks the string to int when the other side is an integer. (The=case is tracked in #30694.)