summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorRamil Kalimullin <ramil@mysql.com>2009-02-05 11:43:39 +0400
committerRamil Kalimullin <ramil@mysql.com>2009-02-05 11:43:39 +0400
commit31d908d70ba6e0240dd85712e474fbc30b95dbd7 (patch)
treee19c468677d8eaea06a43927c41a959d437ce37e /mysql-test
parent243b2639cc7a486016be6ff72a5fec4a722b6807 (diff)
downloadmariadb-git-31d908d70ba6e0240dd85712e474fbc30b95dbd7.tar.gz
Fix for bug#42014: Crash, name_const with collate
Problem: some queries using NAME_CONST(.. COLLATE ...) lead to server crash due to failed type cast. Fix: return the underlying item's type in case of NAME_CONST(.. COLLATE ...) to avoid wrong casting. mysql-test/r/func_misc.result: Fix for bug#42014: Crash, name_const with coll - test result. mysql-test/t/func_misc.test: Fix for bug#42014: Crash, name_const with coll - test case. sql/item.cc: Fix for bug#42014: Crash, name_const with coll - in case of NAME_CONST('name', 'value' COLLATE collation) Item_name_const::type() returns type of 'value' argument to awoid wrong type casting of the Item_name_const items.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/func_misc.result5
-rw-r--r--mysql-test/t/func_misc.test9
2 files changed, 14 insertions, 0 deletions
diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result
index ce177b511b9..e57d46c006a 100644
--- a/mysql-test/r/func_misc.result
+++ b/mysql-test/r/func_misc.result
@@ -319,4 +319,9 @@ select @my_uuid_date - @my_uuid_synthetic;
@my_uuid_date - @my_uuid_synthetic
0
set @@session.time_zone=@save_tz;
+CREATE TABLE t1 (a DATE);
+SELECT * FROM t1 WHERE a = NAME_CONST('reportDate',
+_binary'2009-01-09' COLLATE 'binary');
+a
+DROP TABLE t1;
End of 5.0 tests
diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test
index 93fe94ec94f..c8075c42fc7 100644
--- a/mysql-test/t/func_misc.test
+++ b/mysql-test/t/func_misc.test
@@ -436,5 +436,14 @@ select @my_uuid_date - @my_uuid_synthetic;
set @@session.time_zone=@save_tz;
+
+#
+# Bug#42014: Crash, name_const with collate
+#
+CREATE TABLE t1 (a DATE);
+SELECT * FROM t1 WHERE a = NAME_CONST('reportDate',
+ _binary'2009-01-09' COLLATE 'binary');
+DROP TABLE t1;
+
--echo End of 5.0 tests