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
CAST of non-numeric strings to numeric types errors instead of returning zero #30911
CAST of a string that does not start with a digit to an integer type raises a hard error instead of returning 0 (with a warning) as MySQL does. E.g. CAST('abc12' AS SIGNED) → ERROR 20203, MySQL → 0. This is the explicit-CAST entry point of the same string→integer strictness issue; the comparison entry point ('10.0' = 10) is tracked in #30694 and also still errors on this build.
Environment
MatrixOne dev build 3a1e42b430, server reports 8.0.30-MatrixOne-v1.3.0
MySQL comparison: 8.0.45 (localhost)
Reproduction
SELECT CAST('abc12'AS SIGNED);
-- MatrixOne: ERROR 20203 (HY000) invalid argument cast to int, bad value abc12-- MySQL: 0 (Warning 1292: Truncated incorrect INTEGER value: 'abc12')SELECT CAST(''AS SIGNED); -- MatrixOne: ERROR 20203 bad value '' ; MySQL: 0SELECT CAST('12abc'AS SIGNED); -- both: 12 (leading-digit form works)SELECT CAST('abc'AS UNSIGNED); -- MatrixOne: ERROR ; MySQL: 0
Root cause
The string→integer cast path rejects any string that does not begin with a digit, instead of MySQL's permissive behavior of returning 0 with a 1292 truncation warning. The leading-digit prefix form ('12abc' → 12) already works, so the defect is specifically the non-leading-digit fallback.
Impact
Loosely-typed data (VARCHAR columns holding free-form values) cannot be safely cast to integers; CAST(v AS SIGNED) fails the whole statement on the first non-numeric row, where MySQL would coerce it to 0.
Common ETL normalization (CAST(col AS UNSIGNED)) over mixed-quality columns breaks entirely.
Expected behavior
CAST('abc12' AS SIGNED) and CAST('' AS SIGNED) should return 0 (optionally with a truncation warning), matching MySQL. The leading-digit prefix form is already correct.
changed the title [-][Bug]: CAST(non-numeric string AS SIGNED/UNSIGNED) errors instead of returning 0[/-][+]CAST of non-numeric strings to numeric types errors instead of returning zero[/+]on Oct 23, 2026
The original environment, controls, and report remain on #30912. Extend this issue's acceptance matrix to SIGNED, UNSIGNED, and DECIMAL casts, covering nonnumeric text, empty/whitespace input, valid leading numeric prefixes, target precision/scale, and SQL-mode-appropriate truncation diagnostics. This is the same explicit CAST fallback contract; no fix is claimed.
Tracking consolidated into #30417. The canonical issue now includes this report's independent scope and acceptance criteria. This is administrative consolidation, not a claim that the defect is fixed; the original reproduction and discussion are preserved here.
Activity
[-][Bug]: CAST(non-numeric string AS SIGNED/UNSIGNED) errors instead of returning 0[/-][+]CAST of non-numeric strings to numeric types errors instead of returning zero[/+]XuPeng-SH commentedon Oct 23, 2026
Additional DECIMAL CAST reproduction consolidated from #30912
The same explicit nonnumeric-string CAST behavior occurs for DECIMAL targets:
The original environment, controls, and report remain on #30912. Extend this issue's acceptance matrix to SIGNED, UNSIGNED, and DECIMAL casts, covering nonnumeric text, empty/whitespace input, valid leading numeric prefixes, target precision/scale, and SQL-mode-appropriate truncation diagnostics. This is the same explicit CAST fallback contract; no fix is claimed.
XuPeng-SH commentedon Oct 24, 2026
Tracking consolidated into #30417. The canonical issue now includes this report's independent scope and acceptance criteria. This is administrative consolidation, not a claim that the defect is fixed; the original reproduction and discussion are preserved here.