diff options
author | unknown <holyfoot/hf@mysql.com/hfmain.(none)> | 2007-05-17 00:09:43 +0500 |
---|---|---|
committer | unknown <holyfoot/hf@mysql.com/hfmain.(none)> | 2007-05-17 00:09:43 +0500 |
commit | 5e00d4b7f67a48d64e66f7704a48f71b8e04d158 (patch) | |
tree | 612dc0db782857fa988770f12109ef15e6f573c9 | |
parent | 963fae4b80d6ad96d495a9f187a1897ef0f88a07 (diff) | |
parent | 1e33cfb36a84b477a468dbcfc1ccc3035a9efb81 (diff) | |
download | mariadb-git-5e00d4b7f67a48d64e66f7704a48f71b8e04d158.tar.gz |
Merge bk@192.168.21.1:mysql-5.0-opt
into mysql.com:/home/hf/work/8663/my50-8663
-rw-r--r-- | mysql-test/r/bigint.result | 10 | ||||
-rw-r--r-- | mysql-test/t/bigint.test | 6 | ||||
-rw-r--r-- | strings/decimal.c | 6 |
3 files changed, 21 insertions, 1 deletions
diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result index 541a15561e2..f18d1c9b583 100644 --- a/mysql-test/r/bigint.result +++ b/mysql-test/r/bigint.result @@ -352,3 +352,13 @@ select c1 mod 50 as result from t1; result 6 drop table t1; +select cast(19999999999999999999 as signed); +cast(19999999999999999999 as signed) +9223372036854775807 +Warnings: +Error 1292 Truncated incorrect DECIMAL value: '' +select cast(-19999999999999999999 as signed); +cast(-19999999999999999999 as signed) +-9223372036854775808 +Warnings: +Error 1292 Truncated incorrect DECIMAL value: '' diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test index 6c1229db83f..9a5fb11229d 100644 --- a/mysql-test/t/bigint.test +++ b/mysql-test/t/bigint.test @@ -288,3 +288,9 @@ insert into t1 values (10000002383263201056); select c1 mod 50 as result from t1; drop table t1; +# +# Bug #8663 cant use bgint unsigned as input to cast +# + +select cast(19999999999999999999 as signed); +select cast(-19999999999999999999 as signed); diff --git a/strings/decimal.c b/strings/decimal.c index 65db68b1b59..1ae75167794 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -1083,7 +1083,11 @@ int decimal2longlong(decimal_t *from, longlong *to) x=x*DIG_BASE - *buf++; if (unlikely(y < (LONGLONG_MIN/DIG_BASE) || x > y)) { - *to= from->sign ? y : -y; + /* + the decimal is bigger than any possible integer + return border integer depending on the sign + */ + *to= from->sign ? LONGLONG_MIN : LONGLONG_MAX; return E_DEC_OVERFLOW; } } |