Commit 0bb924e1 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-17830 Server crashes in Item_null_result::field_type upon SELECT with CHARSET(date) and ROLLUP

parent 409dddf6
......@@ -786,5 +786,19 @@ t COUNT(*)
12:12:13 1
DROP TABLE t1;
#
# MDEV-17830 Server crashes in Item_null_result::field_type upon SELECT with CHARSET(date) and ROLLUP
#
# Note, returning "latin1" in the first row vs "binary" in the second row is wrong here.
# Both lines should return equal values.
# The point in this test is to make sure it does not crash.
# Bad result will be fixed in a later version.
CREATE TABLE t (d DATE) ENGINE=MyISAM;
INSERT INTO t VALUES ('2018-12-12');
SELECT CHARSET(d) AS f FROM t GROUP BY d WITH ROLLUP;
f
latin1
binary
DROP TABLE t;
#
# End of 10.1 tests
#
......@@ -424,6 +424,21 @@ SELECT t, COUNT(*) FROM t1 GROUP BY t WITH ROLLUP HAVING t > '00:00:00';
DROP TABLE t1;
--echo #
--echo # MDEV-17830 Server crashes in Item_null_result::field_type upon SELECT with CHARSET(date) and ROLLUP
--echo #
--echo # Note, returning "latin1" in the first row vs "binary" in the second row is wrong here.
--echo # Both lines should return equal values.
--echo # The point in this test is to make sure it does not crash.
--echo # Bad result will be fixed in a later version.
CREATE TABLE t (d DATE) ENGINE=MyISAM;
INSERT INTO t VALUES ('2018-12-12');
SELECT CHARSET(d) AS f FROM t GROUP BY d WITH ROLLUP;
DROP TABLE t;
--echo #
--echo # End of 10.1 tests
--echo #
......@@ -2618,6 +2618,10 @@ class Item_null_result :public Item_null
{
return result_field->type();
}
CHARSET_INFO *charset_for_protocol(void) const
{
return collation.collation;
}
#else
const Type_handler *type_handler() const
{
......@@ -3942,6 +3946,12 @@ class Item_ref :public Item_ident
void save_org_in_field(Field *field, fast_field_copier optimizer_data);
fast_field_copier setup_fast_field_copier(Field *field)
{ return (*ref)->setup_fast_field_copier(field); }
#if MARIADB_VERSION_ID < 100300
CHARSET_INFO *charset_for_protocol(void) const
{
return (*ref)->charset_for_protocol();
}
#endif
enum Item_result result_type () const { return (*ref)->result_type(); }
enum_field_types field_type() const { return (*ref)->field_type(); }
Field *get_tmp_table_field()
......
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