From 5227198908d4f12ab3e5c95e4c8f15e6b9805f10 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Mon, 11 Jun 2018 16:29:22 +0400 Subject: MDEV-16190 Server crashes in Item_null_result::field_type on SELECT with time field, ROLLUP and HAVING virtual Item_null_result::get_date() was not overridden. It used the inherited Item::get_date(), which tests field_type(), which in case of Item_null_result calls result_field->field_type(), and result_field is not really always set (e.g. it's not set in the test case from the bug report). Overriding Item_null::get_date() like it's done for other val_xxx() methods. This make the code more symmetric across data types. In the new reduction, get_date() immediately returns NULL without entering into any data type specific code. --- mysql-test/t/olap.test | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'mysql-test/t/olap.test') diff --git a/mysql-test/t/olap.test b/mysql-test/t/olap.test index fec5df1a1c7..4a61cebdc0d 100644 --- a/mysql-test/t/olap.test +++ b/mysql-test/t/olap.test @@ -404,3 +404,26 @@ SELECT DISTINCT b FROM t1, t2 GROUP BY a, b WITH ROLLUP; DROP TABLE t1, t2; --echo End of 5.0 tests + + +--echo # +--echo # Start of 10.1 tests +--echo # + +--echo # +--echo # MDEV-16190 Server crashes in Item_null_result::field_type on SELECT with time field, ROLLUP and HAVING +--echo # +CREATE TABLE t1 (t TIME) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('12:12:12'); +SELECT t, COUNT(*) FROM t1 GROUP BY t WITH ROLLUP HAVING t > '00:00:00'; +DROP TABLE t1; + +CREATE TABLE t1 (t TIME) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('12:12:12'),('12:12:13'); +SELECT t, COUNT(*) FROM t1 GROUP BY t WITH ROLLUP HAVING t > '00:00:00'; +DROP TABLE t1; + + +--echo # +--echo # End of 10.1 tests +--echo # -- cgit v1.2.1