Bug #9300 | subtraction error | ||
---|---|---|---|
Submitted: | 19 Mar 2005 23:52 | Modified: | 20 Mar 2005 11:36 |
Reporter: | Roy Miller | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S2 (Serious) |
Version: | 4.1.10a | OS: | Linux (suse 8) |
Assigned to: | CPU Architecture: | Any |
[19 Mar 2005 23:52]
Roy Miller
[19 Mar 2005 23:54]
Roy Miller
my original version was 4.0.13 (at the time it was the latest stable version)
[20 Mar 2005 11:36]
MySQL Verification Team
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.mysql.com/documentation/ and the instructions on how to report a bug at http://bugs.mysql.com/how-to-report.php Additional info: One of the argument of substruction is UNSIGNED, so the result is also UNSIGNED. You can run mysqld in NO_UNSIGNED_SUBTRACTION to get signed results of substruction. mysql> SELECT intValue -> , 1111272874 - intValue as intWrong -> , 1111272874 + (- intValue) as intCorrect -> FROM tblTest -> where id = 1; +------------+----------------------+------------+ | intValue | intWrong | intCorrect | +------------+----------------------+------------+ | 1211273405 | 18446744073609551085 | -100000531 | +------------+----------------------+------------+ 1 row in set (0.01 sec) mysql> set sql_mode=NO_UNSIGNED_SUBTRACTION; Query OK, 0 rows affected (0.08 sec) mysql> SELECT intValue -> , 1111272874 - intValue as intWrong -> , 1111272874 + (- intValue) as intCorrect -> FROM tblTest -> where id = 1; +------------+------------+------------+ | intValue | intWrong | intCorrect | +------------+------------+------------+ | 1211273405 | -100000531 | -100000531 | +------------+------------+------------+ 1 row in set (0.01 sec)