Repository navigation
Description
Description
The + operator on two string operands performs string concatenation in MatrixOne, where MySQL performs numeric addition. This is a silent wrong-answer bug — no error, no warning, just a different value.
Environment
- MatrixOne dev build (local multi-CN,
main) - MySQL 8.0.45 control
Reproduction
| Expression | MO | MySQL 8.0.45 |
|---|---|---|
SELECT '1' + '1' |
11 |
2 |
SELECT '2' + '3' |
23 |
5 |
SELECT '10' + '5' |
105 |
15 |
SELECT '1.5' + '2.5' |
1.52.5 |
4 |
SELECT CAST('1' AS CHAR) + CAST('1' AS CHAR) |
11 |
2 |
Note the last row: explicitly casting to CHAR and adding still concatenates, so this is not a literal-only path — it applies to real VARCHAR/CHAR columns too.
Scope check
SELECT CONCAT('1','1') + 0 returns 11 on both engines, which confirms the MO result above is CONCAT semantics leaking into the + operator (in MySQL the + result of CONCAT(...) is '11', coerced to 11 numerically).
Impact
- Silent data corruption in aggregates. A column declared
VARCHAR(extremely common for legacy schemas, CSV imports, and JSON-extracted values) summed with+produces a string instead of a number:MySQL would sum numerically.SELECT SUM(a + b) FROM t; -- if a,b are VARCHAR, MO concatenates then sums garbage
- Any monetary/quantity arithmetic over string-typed columns (a very common situation after
LOAD DATAinto a permissive schema, or after JSON extraction) silently yields wrong totals instead of failing. - Because there is no error, this class of bug survives testing and shows up as wrong business numbers.
- Reporting/BI queries written for MySQL that rely on implicit string→number coercion for
+all break silently.
Related but distinct
The reverse direction (numeric operand + non-numeric string) does match MySQL in erroring, e.g. SELECT 'abc' + 1 errors on both. So the divergence is specific to string + string, which MO routes to concatenation.
Expected behavior
+ between two string operands should coerce both to numbers and add, as MySQL does:
SELECT '1' + '1'; -- 2
SELECT '1.5' + '2.5'; -- 4
SELECT 'abc' + 1; -- error (or 1 under non-strict, matching MySQL) — but not concatenationIf MO intends + to concatenate for strings (as some dialects do), that must not be the default for a MySQL-compatible engine — MySQL users' arithmetic would silently change meaning. Either make + numeric (preferred) or reject string + string with a clear error so the divergence cannot pass silently.
Activity
XuPeng-SH commentedon Oct 26, 2026
Tracking consolidated into #30730. The canonical issue retains this report’s full reproduction/discussion and independent acceptance requirements. This is administrative consolidation, not a claim that the defect is fixed. Original evidence remains preserved here.