summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorunknown <kaa@polly.local>2006-09-08 14:08:29 +0400
committerunknown <kaa@polly.local>2006-09-08 14:08:29 +0400
commitf64483cb909aa557d27fde12090baae41f5d6578 (patch)
treeecd49220ee2f3240b098af7a672ff3a7f0f6b541 /mysql-test/t
parent7a77b3d80fe711fa4e9123a8a7be782bcef1d8db (diff)
downloadmariadb-git-f64483cb909aa557d27fde12090baae41f5d6578.tar.gz
Bug #20924: CAST(expr as UNSIGNED) returns SIGNED value when used in various functions
- Honor unsigned_flag in the corresponding functions - Use compare_int_signed_unsigned()/compare_int_unsigned_signed() instead of explicit comparison in GREATEST() and LEAST() mysql-test/r/case.result: Added test case for bug #20924 mysql-test/r/func_if.result: Added test case for bug #20924 mysql-test/r/func_test.result: Added test case for bug #20924 mysql-test/r/user_var.result: Added test case for bug #20924 mysql-test/t/case.test: Added test case for bug #20924 mysql-test/t/func_if.test: Added test case for bug #20924 mysql-test/t/func_test.test: Added test case for bug #20924 mysql-test/t/user_var.test: Added test case for bug #20924 sql/item_cmpfunc.cc: Bug #20924: CAST(expr as UNSIGNED) returns SIGNED value when used in various functions - Moved some code out of Arg_comparator to external functions to be reused in Item_func_min_max - Fixed IFNULL(), IF(), CASE() and COALESCE() sql/item_cmpfunc.h: Bug #20924: CAST(expr as UNSIGNED) returns SIGNED value when used in various functions - Moved some code out of Arg_comparator to external functions to be reused in Item_func_min_max sql/item_func.cc: Bug #20924: CAST(expr as UNSIGNED) returns SIGNED value when used in various functions Fixed LEAST(), GREATEST() and "SET @a=..." parts sql/item_func.h: Bug #20924: CAST(expr as UNSIGNED) returns SIGNED value when used in various functions Fixed "SET @a=..." part sql/sql_class.h: Bug #20924: CAST(expr as UNSIGNED) returns SIGNED value when used in various functions Fixed "SET @a=..." part
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/case.test6
-rw-r--r--mysql-test/t/func_if.test10
-rw-r--r--mysql-test/t/func_test.test6
-rw-r--r--mysql-test/t/user_var.test6
4 files changed, 28 insertions, 0 deletions
diff --git a/mysql-test/t/case.test b/mysql-test/t/case.test
index fd1b6e5247f..b868ae12b69 100644
--- a/mysql-test/t/case.test
+++ b/mysql-test/t/case.test
@@ -130,4 +130,10 @@ select min(a), min(case when 1=1 then a else NULL end),
from t1 where b=3 group by b;
drop table t1;
+#
+# Bug #20924: UNSIGNED values in CASE and COALESCE are treated as SIGNED
+#
+SELECT CASE 1 WHEN 1 THEN 18446744073709551615 ELSE 1 END;
+SELECT COALESCE(18446744073709551615);
+
# End of 4.1 tests
diff --git a/mysql-test/t/func_if.test b/mysql-test/t/func_if.test
index 5756793c673..17117b07437 100644
--- a/mysql-test/t/func_if.test
+++ b/mysql-test/t/func_if.test
@@ -73,4 +73,14 @@ SELECT a, NULLIF(a,'') FROM t1 WHERE NULLIF(a,'') IS NULL;
DROP TABLE t1;
+#
+# Bug #20924: UNSIGNED values in IF() are treated as SIGNED
+#
+SELECT IF(1 != 0, 18446744073709551615, 1);
+
+#
+# Bug #20924: UNSIGNED values in IFNULL() are treated as SIGNED
+#
+SELECT IFNULL(NULL, 18446744073709551615);
+
# End of 4.1 tests
diff --git a/mysql-test/t/func_test.test b/mysql-test/t/func_test.test
index 2ad64b6c5a6..631639c7a74 100644
--- a/mysql-test/t/func_test.test
+++ b/mysql-test/t/func_test.test
@@ -108,4 +108,10 @@ select 5.1 mod 3, 5.1 mod -3, -5.1 mod 3, -5.1 mod -3;
select 5 mod 3, 5 mod -3, -5 mod 3, -5 mod -3;
+#
+# Bug #20924: UNSIGNED values in GREATEST() and LEAST() are treated as SIGNED
+#
+SELECT GREATEST(1, 18446744073709551615);
+SELECT LEAST(1, 18446744073709551615);
+
# End of 4.1 tests
diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test
index 7691a574a2a..810d5e96da5 100644
--- a/mysql-test/t/user_var.test
+++ b/mysql-test/t/user_var.test
@@ -141,4 +141,10 @@ select @@global.version;
--replace_column 1 #
select @@session.VERSION;
+#
+# Bug #20924 SET on a user variable saves UNSIGNED as SIGNED
+#
+set @a=18446744073709551615;
+select @a;
+
# End of 4.1 tests