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
Indeed, the SQL compiler does not up-cast the type of the arithmetic expression.
It can not be compensated for in the MAL optimizer, which does not properly check for the overflow either.
The short term solution is to disable the constant evaluate() optimizer.
Date: 2017-02-06 16:10:09 +0100
From: @kutsurak
To: SQL devs <>
Version: 11.25.5 (Dec2016-SP1)
CC: @mlkersten, @njnes, @drstmane
Last updated: 2017-03-03 10:24:23 +0100
Comment 24976
Date: 2017-02-06 16:10:09 +0100
From: @kutsurak
User-Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0
Build Identifier:
Addition with integer literals produces overflows:
Reproducible: Always
Steps to Reproduce:
1.SELECT 20000+30000;
2.
3.
Actual Results:
+--------+
| L2 |
+========+
| -15536 |
+--------+
Expected Results:
+-------+
| L3 |
+=======+
| 50000 |
+-------+
Comment 24977
Date: 2017-02-06 20:58:04 +0100
From: @mlkersten
Indeed, the SQL compiler does not up-cast the type of the arithmetic expression.
It can not be compensated for in the MAL optimizer, which does not properly check for the overflow either.
The short term solution is to disable the constant evaluate() optimizer.
Comment 24978
Date: 2017-02-06 21:31:06 +0100
From: @drstmane
sql>declare a smallint;
operation successful (0.939ms)
sql>declare b smallint;
operation successful (1.144ms)
sql>set a = 20000;
operation successful (0.966ms)
sql>set b = 30000;
operation successful (0.974ms)
sql>select a + b;
+-------+
| L2 |
+=======+
| 50000 |
+-------+
1 tuple (1.006ms)
Comment 24979
Date: 2017-02-06 21:32:15 +0100
From: @drstmane
sql>select cast(20000 as smallint) + cast(30000 as smallint);
+-------+
| L4 |
+=======+
| 50000 |
+-------+
1 tuple (2.386ms)
Comment 24986
Date: 2017-02-08 12:42:14 +0100
From: @njnes
fixed call conversion operator (ie with proper (large enough) types.
Comment 24994
Date: 2017-02-09 12:15:39 +0100
From: MonetDB Mercurial Repository <>
Changeset 7c14a3a849fb made by Jennie Zhang y.zhang@cwi.nl in the MonetDB repo, refers to this bug.
For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=7c14a3a849fb
Changeset description:
Comment 25115
Date: 2017-03-03 10:24:23 +0100
From: @sjoerdmullender
Dec2016-SP2 has been released, incorporating the fix.
The text was updated successfully, but these errors were encountered: