summaryrefslogtreecommitdiff
path: root/mysql-test/t/bigint.test
diff options
context:
space:
mode:
authorunknown <cmiller@zippy.cornsilk.net>2006-11-15 12:23:07 -0500
committerunknown <cmiller@zippy.cornsilk.net>2006-11-15 12:23:07 -0500
commit3be6493aab368e43165cd523963cf513f1588ac5 (patch)
tree861aa378cb1978a81513844f768406f678517ff6 /mysql-test/t/bigint.test
parent574902e355362f70e888c57698ec9147f69a6351 (diff)
downloadmariadb-git-3be6493aab368e43165cd523963cf513f1588ac5.tar.gz
Bug#19955: unsigned bigint used as signed with MOD function
Problem: When we have a really large number (between 2^63 and 2^64) as the left side of the mod operator, it gets improperly corerced into a signed value. Solution: Added check to see if the "negative" number is really positive, and if so, cast it. mysql-test/r/bigint.result: Added test case result mysql-test/t/bigint.test: Added test case sql/item_func.cc: Added check to see if we have an unsigned number that looks like a signed number.
Diffstat (limited to 'mysql-test/t/bigint.test')
-rw-r--r--mysql-test/t/bigint.test9
1 files changed, 9 insertions, 0 deletions
diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test
index 35cda11646a..6c1229db83f 100644
--- a/mysql-test/t/bigint.test
+++ b/mysql-test/t/bigint.test
@@ -278,4 +278,13 @@ select * from t1 where bigint_col=17666000000000000000;
select * from t1 where bigint_col='17666000000000000000';
drop table t1;
+--echo
+--echo bug 19955 -- mod is signed with bigint
+
+select cast(10000002383263201056 as unsigned) mod 50 as result;
+
+create table t1 (c1 bigint unsigned);
+insert into t1 values (10000002383263201056);
+select c1 mod 50 as result from t1;
+drop table t1;