summaryrefslogtreecommitdiff
path: root/mysql-test/t/date_formats.test
diff options
context:
space:
mode:
authorunknown <evgen@moonbone.local>2005-10-25 20:37:26 +0400
committerunknown <evgen@moonbone.local>2005-10-25 20:37:26 +0400
commitb96dbef6fd553360f13a52d2b496fe7d86665e7c (patch)
treeaae868ddbefc26a40a216f2bb05d0aca1b3739ed /mysql-test/t/date_formats.test
parent6e49a48a25465eeb8e9e4c6b510b78ed508242bc (diff)
downloadmariadb-git-b96dbef6fd553360f13a52d2b496fe7d86665e7c.tar.gz
Fix bug #14016 date_format() 2nd parameter was compared using case insensitive
collation By default constant strings in second parameter of date_time() have case insensitive collation. Because of this expressions date_format(f,'%m') and date_format(f,'%M') wrongly becomes equal, which results in choosing wrong column to sort by. Now if second parameter of date_format() is constant then it's collation is changed to case sensitive. sql/item_timefunc.cc: Fix bug #14016 date_format() 2nd parameter was compared using case insensitive collation. If second parameter of date_format() is constant then it's collation is changed to case sensitive. mysql-test/r/date_formats.result: Test case for bug#14016 2nd parameter was compared using case insensitive collation mysql-test/t/date_formats.test: Test case for bug#14016 2nd parameter was compared using case insensitive collation
Diffstat (limited to 'mysql-test/t/date_formats.test')
-rw-r--r--mysql-test/t/date_formats.test8
1 files changed, 8 insertions, 0 deletions
diff --git a/mysql-test/t/date_formats.test b/mysql-test/t/date_formats.test
index 62e9d81021e..6d501865d2c 100644
--- a/mysql-test/t/date_formats.test
+++ b/mysql-test/t/date_formats.test
@@ -260,4 +260,12 @@ select str_to_date("2003-04-05 g", "%Y-%m-%d") as f1,
str_to_date("2003-04-05 10:11:12.101010234567", "%Y-%m-%d %H:%i:%S.%f") as f2;
--enable_ps_protocol
+#
+# Bug #14016
+#
+create table t1 (f1 datetime);
+insert into t1 (f1) values ("2005-01-01");
+insert into t1 (f1) values ("2005-02-01");
+select date_format(f1, "%m") as d1, date_format(f1, "%M") as d2 from t1 order by date_format(f1, "%M");
+drop table t1;
# End of 4.1 tests