summaryrefslogtreecommitdiff
path: root/mysql-test/t/cast.test
diff options
context:
space:
mode:
authorunknown <jimw@rama.(none)>2006-07-12 13:22:38 -0700
committerunknown <jimw@rama.(none)>2006-07-12 13:22:38 -0700
commit2fc276d54f43ec063019ce261fb9b9a17e484c96 (patch)
treea62c206cafe37632e7eae07821fbe93990d86fb9 /mysql-test/t/cast.test
parenta7dddd3b67e70292c0813e80ad255f1dc2f3a867 (diff)
downloadmariadb-git-2fc276d54f43ec063019ce261fb9b9a17e484c96.tar.gz
Bug #17903: cast to char results in binary
The character set was not being properly initialized in CAST() with a type like "CHAR(2) BINARY", which resulted in incorrect results or even a crash. mysql-test/r/cast.result: Add new results mysql-test/t/cast.test: Add new regression test sql/sql_yacc.yy: Make sure Lex->charset is set to NULL when nothing follows BINARY in type declaration.
Diffstat (limited to 'mysql-test/t/cast.test')
-rw-r--r--mysql-test/t/cast.test14
1 files changed, 13 insertions, 1 deletions
diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test
index 533da542855..ecc92ed01d1 100644
--- a/mysql-test/t/cast.test
+++ b/mysql-test/t/cast.test
@@ -204,7 +204,19 @@ SELECT CAST(v AS DECIMAL), CAST(tt AS DECIMAL), CAST(t AS DECIMAL),
CAST(mt AS DECIMAL), CAST(lt AS DECIMAL) from t1;
DROP TABLE t1;
-# Bug @10237 (CAST(NULL DECIMAL) crashes server)
+
+#
+# Bug #10237 (CAST(NULL DECIMAL) crashes server)
#
select cast(NULL as decimal(6)) as t1;
+
+#
+# Bug #17903: cast to char results in binary
+#
+set names latin1;
+select hex(cast('a' as char(2) binary));
+select hex(cast('a' as binary(2)));
+select hex(cast('a' as char(2) binary));
+
+--echo End of 5.0 tests