Commit d8a9b524 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-14221 Assertion `0' failed in Item::field_type_for_temporal_comparison

parent 892cf2de
......@@ -843,5 +843,16 @@ Warning 1292 Incorrect datetime value: '1'
Warning 1292 Incorrect datetime value: '1'
DROP TABLE t1;
#
# MDEV-14221 Assertion `0' failed in Item::field_type_for_temporal_comparison
#
CREATE TABLE t1 (d DATE);
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;
d COUNT(*)
1985-05-13 1
1989-12-24 1
NULL 2
DROP TABLE t1;
#
# End of 10.1 tests
#
......@@ -576,6 +576,15 @@ SELECT DATE(a), DATE(b), DATE(c) FROM t1;
SELECT DATE(COALESCE(a)), DATE(COALESCE(b)), DATE(COALESCE(c)) FROM t1;
DROP TABLE t1;
--echo #
--echo # MDEV-14221 Assertion `0' failed in Item::field_type_for_temporal_comparison
--echo #
CREATE TABLE t1 (d DATE);
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 # End of 10.1 tests
......
......@@ -2581,6 +2581,17 @@ class Item_null_result :public Item_null
Field *result_field;
Item_null_result(THD *thd): Item_null(thd), result_field(0) {}
bool is_result_field() { return result_field != 0; }
#if MARIADB_VERSION_ID < 100300
enum_field_types field_type() const
{
return result_field->type();
}
#else
const Type_handler *type_handler() const
{
return result_field->type_handler();
}
#endif
void save_in_result_field(bool no_conversions)
{
save_in_field(result_field, no_conversions);
......
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