summaryrefslogtreecommitdiff
path: root/mysql-test/t/cast.test
diff options
context:
space:
mode:
authorunknown <bar@mysql.com>2006-06-14 13:40:21 +0500
committerunknown <bar@mysql.com>2006-06-14 13:40:21 +0500
commita1017b09b4a76f3cb827bae318ab8785e65b341b (patch)
tree6a669fea8bf6742d985b476b463b71b9c61730ea /mysql-test/t/cast.test
parentf1b1c0eb3f916591c059da8c21334e848ae75b43 (diff)
downloadmariadb-git-a1017b09b4a76f3cb827bae318ab8785e65b341b.tar.gz
Bug#8663 cant use bgint unsigned as input to cast
Problem: cast to unsigned limited result to max signed bigint 9223372036854775808, instead of max unsigned bigint 18446744073709551615. Fix: don't use args[0]->val_int() when casting from a floating point number, use val() instead, with range checkings, special to unsigned data type. item_func.cc: Special handling of cast from REAL_RESULT to unsigned int: we cannot execute args[0]->val_int() because it cuts max allowed value to LONGLONG_INT, instead of ULONGLONG_INT required. count_distinct3.test: Getting rid of "Data truncated; out of range ..." warnings. cast.test, cast.result: Adding test case. ps.result: Fixing that cast from 6570515219.6535 to unsigned didn't round to 6570515220, and returned 6570515219 instead. mysql-test/r/cast.result: Adding test case. mysql-test/r/ps.result: Fixing that cast from 6570515219.6535 to unsigned didn't round to 6570515220, and returned 6570515219 instead. mysql-test/t/cast.test: Adding test case. mysql-test/t/count_distinct3.test: Get rid of "wring unsigned value" warnings. sql/item_func.cc: Special handling of cast from REAL)RESULT to unsigned int: we cannot execute args[0]->val_int() because it cuts max allowed value to LONGLONG_INT, instead of ULONGLONG_INT required.
Diffstat (limited to 'mysql-test/t/cast.test')
-rw-r--r--mysql-test/t/cast.test6
1 files changed, 6 insertions, 0 deletions
diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test
index 4d73783dd52..b214cef10fa 100644
--- a/mysql-test/t/cast.test
+++ b/mysql-test/t/cast.test
@@ -148,6 +148,12 @@ select cast(repeat('1',20) as unsigned);
select cast(repeat('1',20) as signed);
#
+# Bug#8663 cant use bgint unsigned as input to cast
+#
+select cast(19999999999999999999 as unsigned);
+
+
+#
# Bug #13344: cast of large decimal to signed int not handled correctly
#
select cast(1.0e+300 as signed int);