Commit a4e59020 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-8862 Wrong field type for MAX(COALESCE(datetime_column))

parent c5922c57
......@@ -1206,5 +1206,14 @@ Warning 1292 Incorrect time value: '9000000' for column 'b' at row 4
Warning 1292 Incorrect time value: '9000000' for column 'c' at row 4
DROP TABLE t1;
#
# MDEV-8862 Wrong field type for MAX(COALESCE(datetime_column))
#
CREATE TABLE t1 (a TIME);
INSERT INTO t1 VALUES ('10:10:10'),('10:20:30');
SELECT MAX(a), MAX(COALESCE(a)) FROM t1;
MAX(a) MAX(COALESCE(a))
10:20:30 10:20:30
DROP TABLE t1;
#
# End of 10.1 tests
#
......@@ -715,6 +715,14 @@ INSERT INTO t1 VALUES (9000000,9000000,9000000);
SELECT a, TIME(a),TIME(b),TIME(c) FROM t1 ORDER BY a;
DROP TABLE t1;
--echo #
--echo # MDEV-8862 Wrong field type for MAX(COALESCE(datetime_column))
--echo #
CREATE TABLE t1 (a TIME);
INSERT INTO t1 VALUES ('10:10:10'),('10:20:30');
SELECT MAX(a), MAX(COALESCE(a)) FROM t1;
DROP TABLE t1;
--echo #
--echo # End of 10.1 tests
--echo #
......@@ -1089,7 +1089,9 @@ bool Item_func_hybrid_result_type::get_date(MYSQL_TIME *ltime,
case STRING_RESULT:
{
if (is_temporal_type(field_type()))
return date_op(ltime, fuzzydate);
return date_op(ltime,
fuzzydate |
(field_type() == MYSQL_TYPE_TIME ? TIME_TIME_ONLY : 0));
char buff[40];
String tmp(buff,sizeof(buff), &my_charset_bin),*res;
if (!(res= str_op(&tmp)) ||
......
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