summaryrefslogtreecommitdiff
path: root/mysql-test/t/case.test
diff options
context:
space:
mode:
authorunknown <bar@bar.mysql.r18.ru>2003-07-18 12:42:35 +0500
committerunknown <bar@bar.mysql.r18.ru>2003-07-18 12:42:35 +0500
commita975548b53bde25032c6d381bba7dd9872111124 (patch)
tree07fbba18e54054e03f96d89b0e8db88fc0506a87 /mysql-test/t/case.test
parent926b05ed0ebd6bb00fe762fa79f80a38250285d0 (diff)
downloadmariadb-git-a975548b53bde25032c6d381bba7dd9872111124.tar.gz
Some fixes in CASE.
Test suit was extended to conver various arguments mixes.
Diffstat (limited to 'mysql-test/t/case.test')
-rw-r--r--mysql-test/t/case.test39
1 files changed, 38 insertions, 1 deletions
diff --git a/mysql-test/t/case.test b/mysql-test/t/case.test
index 0249a8eefba..8aa17061174 100644
--- a/mysql-test/t/case.test
+++ b/mysql-test/t/case.test
@@ -42,6 +42,44 @@ insert into t1 values (1,1,'orange'),(1,2,'large'),(2,1,'yellow'),(2,2,'medium')
select max(case col when 1 then val else null end) as color from t1 group by row;
drop table t1;
+SET NAMES latin1;
+
+#
+# CASE and argument types/collations aggregation into result
+#
+CREATE TABLE t1 SELECT
+ CASE WHEN 1 THEN _latin1'a' COLLATE latin1_danish_ci ELSE _latin1'a' END AS c1,
+ CASE WHEN 1 THEN _latin1'a' ELSE _latin1'a' COLLATE latin1_danish_ci END AS c2,
+ CASE WHEN 1 THEN 'a' ELSE 1 END AS c3,
+ CASE WHEN 1 THEN 1 ELSE 'a' END AS c4,
+ CASE WHEN 1 THEN 'a' ELSE 1.0 END AS c5,
+ CASE WHEN 1 THEN 1.0 ELSE 'a' END AS c6,
+ CASE WHEN 1 THEN 1 ELSE 1.0 END AS c7,
+ CASE WHEN 1 THEN 1.0 ELSE 1 END AS c8
+;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+--error 1265
+SELECT CASE
+ WHEN 1
+ THEN _latin1'a' COLLATE latin1_danish_ci
+ ELSE _latin1'a' COLLATE latin1_swedish_ci
+ END;
+
+--error 1268
+SELECT CASE _latin1'a' COLLATE latin1_general_ci
+ WHEN _latin1'a' COLLATE latin1_danish_ci THEN 1
+ WHEN _latin1'a' COLLATE latin1_swedish_ci THEN 2
+ END;
+
+SELECT
+CASE _latin1'a' COLLATE latin1_general_ci WHEN _latin1'A' THEN '1' ELSE 2 END,
+CASE _latin1'a' COLLATE latin1_bin WHEN _latin1'A' THEN '1' ELSE 2 END,
+CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_swedish_ci THEN '1' ELSE 2 END,
+CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_bin THEN '1' ELSE 2 END
+;
+
#
# COALESCE is a CASE abbrevation:
#
@@ -52,7 +90,6 @@ drop table t1;
#
# Check COALESCE argument types aggregation
-SET NAMES latin1;
--error 1265
CREATE TABLE t1 SELECT COALESCE(_latin1'a',_latin2'a');
--error 1265