Commit f467f4bb authored by Alexander Barkov's avatar Alexander Barkov

MDEV-5459 Illegal mix of collations for datetime

parent 1081e403
......@@ -3282,5 +3282,15 @@ SELECT COALESCE(IF(test1=1, NULL, 1), test2) FROM t1;
COALESCE(IF(test1=1, NULL, 1), test2)
DROP TABLE t1;
#
# MDEV-5459 Illegal mix of collations for datetime
#
SET NAMES cp1251;
CREATE TABLE t1 (dt DATETIME);
INSERT INTO t1 VALUES ('2014-01-02 10:20:30');
SELECT date(dt) FROM t1 WHERE (CASE WHEN 1 THEN date(dt) ELSE null END >= '2013-12-01 00:00:00');
date(dt)
2014-01-02
DROP TABLE t1;
#
# End of 5.5 tests
#
......@@ -95,6 +95,14 @@ SELECT COALESCE(IF(test1=1, 1, NULL), test2) FROM t1;
SELECT COALESCE(IF(test1=1, NULL, 1), test2) FROM t1;
DROP TABLE t1;
--echo #
--echo # MDEV-5459 Illegal mix of collations for datetime
--echo #
SET NAMES cp1251;
CREATE TABLE t1 (dt DATETIME);
INSERT INTO t1 VALUES ('2014-01-02 10:20:30');
SELECT date(dt) FROM t1 WHERE (CASE WHEN 1 THEN date(dt) ELSE null END >= '2013-12-01 00:00:00');
DROP TABLE t1;
--echo #
--echo # End of 5.5 tests
......
......@@ -549,8 +549,8 @@ void Item_bool_func2::fix_length_and_dec()
*/
DTCollation coll;
if (args[0]->result_type() == STRING_RESULT &&
args[1]->result_type() == STRING_RESULT &&
if (args[0]->cmp_type() == STRING_RESULT &&
args[1]->cmp_type() == STRING_RESULT &&
agg_arg_charsets_for_comparison(coll, args, 2))
return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment