summaryrefslogtreecommitdiff
path: root/mysql-test/t/cast.test
diff options
context:
space:
mode:
authorunknown <bar@mysql.com>2004-09-07 15:42:19 +0500
committerunknown <bar@mysql.com>2004-09-07 15:42:19 +0500
commit95f42e1da29deb3fb2843c5066ea8692e7bdca08 (patch)
tree256da1b65d60ac047776d8ed3c5bd1d23a364457 /mysql-test/t/cast.test
parent7e7dfcccd64472c9d46b319e997181d0354b668c (diff)
downloadmariadb-git-95f42e1da29deb3fb2843c5066ea8692e7bdca08.tar.gz
Bug #5228 ORDER BY CAST(enumcol) sorts incorrectly under certain conditions
Diffstat (limited to 'mysql-test/t/cast.test')
-rw-r--r--mysql-test/t/cast.test13
1 files changed, 13 insertions, 0 deletions
diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test
index e2deb792d47..e5681dedbac 100644
--- a/mysql-test/t/cast.test
+++ b/mysql-test/t/cast.test
@@ -95,3 +95,16 @@ select cast("2001-1-1" as datetime) = "2001-01-01 00:00:00";
select cast("1:2:3" as TIME) = "1:02:03";
select cast(NULL as DATE);
select cast(NULL as BINARY);
+
+#
+# Bug #5228 ORDER BY CAST(enumcol) sorts incorrectly under certain conditions
+#
+CREATE TABLE t1 (a enum ('aac','aab','aaa') not null);
+INSERT INTO t1 VALUES ('aaa'),('aab'),('aac');
+# these two should be in enum order
+SELECT a, CAST(a AS CHAR) FROM t1 ORDER BY CAST(a AS UNSIGNED) ;
+SELECT a, CAST(a AS CHAR(3)) FROM t1 ORDER BY CAST(a AS CHAR(2)), a;
+# these two should be in alphabetic order
+SELECT a, CAST(a AS UNSIGNED) FROM t1 ORDER BY CAST(a AS CHAR) ;
+SELECT a, CAST(a AS CHAR(2)) FROM t1 ORDER BY CAST(a AS CHAR(3)), a;
+DROP TABLE t1;