summaryrefslogtreecommitdiff
path: root/mysql-test/r/case.result
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/r/case.result')
-rw-r--r--mysql-test/r/case.result108
1 files changed, 108 insertions, 0 deletions
diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result
index 4d5edbda1ce..08fa5a79743 100644
--- a/mysql-test/r/case.result
+++ b/mysql-test/r/case.result
@@ -403,3 +403,111 @@ DROP TABLE t1;
#
# End of 10.1 test
#
+#
+# Start of 10.3 tests
+#
+#
+# MDEV-11554 Wrong result for CASE on a mixture of signed and unsigned expressions
+#
+CREATE TABLE t1 (a BIGINT, b BIGINT UNSIGNED);
+INSERT INTO t1 VALUES (-9223372036854775808,18446744073709551615);
+SELECT
+CASE -1
+WHEN -9223372036854775808 THEN 'one'
+ WHEN 18446744073709551615 THEN 'two'
+ END AS c;
+c
+NULL
+PREPARE stmt FROM "SELECT
+ CASE -1
+ WHEN -9223372036854775808 THEN 'one'
+ WHEN 18446744073709551615 THEN 'two'
+ END AS c";
+EXECUTE stmt;
+c
+NULL
+EXECUTE stmt;
+c
+NULL
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+#
+# MDEV-11555 CASE with a mixture of TIME and DATETIME returns a wrong result
+#
+SELECT
+CASE TIME'10:20:30'
+ WHEN 102030 THEN 'one'
+ WHEN TIME'10:20:31' THEN 'two'
+ END AS good,
+CASE TIME'10:20:30'
+ WHEN 102030 THEN 'one'
+ WHEN TIME'10:20:31' THEN 'two'
+ WHEN TIMESTAMP'2001-01-01 10:20:32' THEN 'three'
+ END AS was_bad_now_good;
+good was_bad_now_good
+one one
+PREPARE stmt FROM "SELECT
+ CASE TIME'10:20:30'
+ WHEN 102030 THEN 'one'
+ WHEN TIME'10:20:31' THEN 'two'
+ END AS good,
+ CASE TIME'10:20:30'
+ WHEN 102030 THEN 'one'
+ WHEN TIME'10:20:31' THEN 'two'
+ WHEN TIMESTAMP'2001-01-01 10:20:32' THEN 'three'
+ END AS was_bad_now_good";
+EXECUTE stmt;
+good was_bad_now_good
+one one
+EXECUTE stmt;
+good was_bad_now_good
+one one
+DEALLOCATE PREPARE stmt;
+#
+# MDEV-13864 Change Item_func_case to store the predicant in args[0]
+#
+SET NAMES latin1;
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
+INSERT INTO t1 VALUES ('a'),('b'),('c');
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE a WHEN 'a' THEN 'a' ELSE 'a' END='a';
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a'
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE 'a' WHEN a THEN 'a' ELSE 'a' END='a';
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a'
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE 'a' WHEN 'a' THEN a ELSE 'a' END='a';
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' and (case 'a' when 'a' then `test`.`t1`.`a` else 'a' end) = 'a'
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE 'a' WHEN 'a' THEN 'a' ELSE a END='a';
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' and (case 'a' when 'a' then 'a' else `test`.`t1`.`a` end) = 'a'
+ALTER TABLE t1 MODIFY a VARBINARY(10);
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE a WHEN 'a' THEN 'a' ELSE 'a' END='a';
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a'
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE 'a' WHEN a THEN 'a' ELSE 'a' END='a';
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a'
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE 'a' WHEN 'a' THEN a ELSE 'a' END='a';
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a'
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE 'a' WHEN 'a' THEN 'a' ELSE a END='a';
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a'
+DROP TABLE t1;