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 overflow in SELECT and SUM silently wraps around instead of throwing error #22734
MatrixOne currently allows integer overflow in SELECT arithmetic expressions and SUM aggregate functions to silently wrap around, returning incorrect results instead of throwing an error. This is a critical data correctness issue that violates SQL standards and differs from all major databases (MySQL, PostgreSQL, Oracle, SQL Server).
Example 1: SELECT Arithmetic Overflow
-- Current behavior (WRONG)SELECT9223372036854775807+1;
-- Returns: -9223372036854775808 ❌ (wraps to MIN_BIGINT)-- Expected behavior (MySQL 8.0 / PostgreSQL)SELECT9223372036854775807+1;
-- ERROR 1690 (22003): BIGINT value is out of range
Example 2: Multiplication Overflow
-- Current behavior (WRONG)SELECT9223372036854775807*2;
-- Returns: -2 ❌ (completely wrong!)-- Expected behavior-- ERROR: BIGINT value is out of range
Example 3: SUM Aggregate Overflow
-- Current behavior (WRONG)CREATETABLEt (val BIGINT);
INSERT INTO t VALUES (9223372036854775807), (9223372036854775807), (9223372036854775807);
SELECTSUM(val) FROM t;
-- Returns: 9223372036854775805 or -2 ❌ (wrong result)-- Expected behavior-- ERROR: BIGINT value is out of range in aggregate SUM
Activity