Commit f4b27400 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-17299 Assertion `maybe_null' failed in make_sortkey

parent 056b6fe1
......@@ -854,5 +854,30 @@ d COUNT(*)
NULL 2
DROP TABLE t1;
#
# MDEV-17299 Assertion `maybe_null' failed in make_sortkey
#
CREATE TABLE t1 (pk int NOT NULL, d1 date, d2 date NOT NULL);
INSERT INTO t1 values (1,'2018-06-22','2018-06-22'),(2,'2018-07-11','2018-07-11');
CREATE VIEW v1 AS SELECT * FROM t1;
SELECT group_concat(d1/(CASE 'b' WHEN 'j' THEN 'c' END))
FROM v1 GROUP BY greatest(pk, 0, d2);
group_concat(d1/(CASE 'b' WHEN 'j' THEN 'c' END))
NULL
Warnings:
Warning 1292 Incorrect datetime value: '1' for column 'pk' at row 1
Warning 1292 Incorrect datetime value: '2' for column 'pk' at row 1
Warning 1292 Incorrect datetime value: '1' for column 'pk' at row 1
Warning 1292 Incorrect datetime value: '1' for column 'pk' at row 1
Warning 1292 Incorrect datetime value: '2' for column 'pk' at row 2
CREATE TABLE t2 AS SELECT greatest(pk, 0, d2) AS c1 FROM t1 LIMIT 0;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`c1` date DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
DROP VIEW v1;
DROP TABLE t1;
#
# End of 10.1 tests
#
......@@ -585,6 +585,20 @@ INSERT INTO t1 VALUES ('1985-05-13'),('1989-12-24');
SELECT d, COUNT(*) FROM t1 GROUP BY d WITH ROLLUP HAVING CASE d WHEN '2017-05-25' THEN 0 ELSE 1 END;
DROP TABLE t1;
--echo #
--echo # MDEV-17299 Assertion `maybe_null' failed in make_sortkey
--echo #
CREATE TABLE t1 (pk int NOT NULL, d1 date, d2 date NOT NULL);
INSERT INTO t1 values (1,'2018-06-22','2018-06-22'),(2,'2018-07-11','2018-07-11');
CREATE VIEW v1 AS SELECT * FROM t1;
SELECT group_concat(d1/(CASE 'b' WHEN 'j' THEN 'c' END))
FROM v1 GROUP BY greatest(pk, 0, d2);
CREATE TABLE t2 AS SELECT greatest(pk, 0, d2) AS c1 FROM t1 LIMIT 0;
SHOW CREATE TABLE t2;
DROP TABLE t2;
DROP VIEW v1;
DROP TABLE t1;
--echo #
--echo # End of 10.1 tests
......
......@@ -2794,6 +2794,8 @@ void Item_func_min_max::fix_length_and_dec()
switch (tmp_cmp_type) {
case TIME_RESULT:
// At least one temporal argument was found.
if (temporal_type_count < arg_count)
maybe_null= true; // Non-temporal-to-temporal conversion can return NULL
collation.set_numeric();
set_handler_by_field_type(temporal_field_type);
if (is_temporal_type_with_time(temporal_field_type))
......
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