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]: CAST(non-numeric string AS DECIMAL) errors instead of returning 0.00 #30912
CAST of a non-numeric string to DECIMAL raises a hard error, while MySQL returns 0.00 (with a truncation warning). CAST('abc' AS DECIMAL(10,2)) → ERROR 20301: "abc" is invalid decimal string on MatrixOne, 0.00 on MySQL. This is the DECIMAL entry point of the string→numeric strictness issue (the integer entry is #30911, the DOUBLE entry already returns 0 correctly).
Environment
MatrixOne dev build 3a1e42b430, server reports 8.0.30-MatrixOne-v1.3.0
The string→DECIMAL cast path rejects any string that is not a valid decimal literal, instead of MySQL's permissive behavior of returning 0.00 with a 1292 warning. The DOUBLE cast path already coerces non-numeric strings to 0, and the leading-numeric prefix works for DECIMAL too (CAST('12.345' ...)), so the defect is specifically the non-numeric-string fallback for DECIMAL.
Impact
CAST(v AS DECIMAL(p,s)) over mixed-quality VARCHAR columns fails the whole statement on the first non-numeric value, where MySQL would coerce it to 0.00.
Breaks monetary/normalization ETL (CAST(amount_str AS DECIMAL(12,2))) whenever source data contains stray text.
Expected behavior
CAST('abc' AS DECIMAL(10,2)) and CAST('' AS DECIMAL(10,2)) should return 0.00 (optionally with a truncation warning), matching MySQL and the already-correct DOUBLE path.
This explicit string-to-numeric CAST failure is now tracked under #30911, which has been expanded to include DECIMAL targets as well as SIGNED/UNSIGNED integer targets. The parent records this report's decimal result, empty-string case, valid-prefix control, precision/scale, and warning expectations. The original reproduction remains here.
Closing as a duplicate tracking item only; no fix is claimed.
Activity
XuPeng-SH commentedon Oct 23, 2026
This explicit string-to-numeric CAST failure is now tracked under #30911, which has been expanded to include DECIMAL targets as well as SIGNED/UNSIGNED integer targets. The parent records this report's decimal result, empty-string case, valid-prefix control, precision/scale, and warning expectations. The original reproduction remains here.
Closing as a duplicate tracking item only; no fix is claimed.