diff options
author | unknown <cmiller@zippy.cornsilk.net> | 2006-11-15 12:24:21 -0500 |
---|---|---|
committer | unknown <cmiller@zippy.cornsilk.net> | 2006-11-15 12:24:21 -0500 |
commit | 011513bd4987270f35a5ba3ce1a424f8532c50b9 (patch) | |
tree | 3a1b5f89c5d0b245588f6585fc7df9641d5cf7e4 | |
parent | 504d8208511f95de07f0523297e9eea7647b64e3 (diff) | |
parent | 3be6493aab368e43165cd523963cf513f1588ac5 (diff) | |
download | mariadb-git-011513bd4987270f35a5ba3ce1a424f8532c50b9.tar.gz |
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug19955/my50-bug19955
into zippy.cornsilk.net:/home/cmiller/work/mysql/bug19955/my51-bug19955
mysql-test/r/bigint.result:
Auto merged
sql/item_func.cc:
Auto merged
-rw-r--r-- | mysql-test/r/bigint.result | 11 | ||||
-rw-r--r-- | mysql-test/t/bigint.test | 9 | ||||
-rw-r--r-- | sql/item_func.cc | 4 |
3 files changed, 24 insertions, 0 deletions
diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result index c27ce18cfd3..d8f78cd5103 100644 --- a/mysql-test/r/bigint.result +++ b/mysql-test/r/bigint.result @@ -341,3 +341,14 @@ select * from t1 where bigint_col='17666000000000000000'; bigint_col 17666000000000000000 drop table t1; + +bug 19955 -- mod is signed with bigint +select cast(10000002383263201056 as unsigned) mod 50 as result; +result +6 +create table t1 (c1 bigint unsigned); +insert into t1 values (10000002383263201056); +select c1 mod 50 as result from t1; +result +6 +drop table t1; 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; diff --git a/sql/item_func.cc b/sql/item_func.cc index 5712ad38fa4..f31f0d80c49 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1346,6 +1346,10 @@ longlong Item_func_mod::int_op() signal_divide_by_null(); return 0; } + + if (args[0]->unsigned_flag) + return ((ulonglong) value) % val2; + return value % val2; } |