Commit d97a26a6 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-18145 Assertion `0' failed in Item::val_native upon SELECT subquery with timestamp

parent ac9b818c
...@@ -1152,5 +1152,17 @@ f ...@@ -1152,5 +1152,17 @@ f
NULL NULL
DROP TABLE t1; DROP TABLE t1;
# #
# MDEV-18145 Assertion `0' failed in Item::val_native upon SELECT subquery with timestamp
#
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1),(2);
CREATE TABLE t3 (pk INT PRIMARY KEY, b TIMESTAMP) ENGINE=MyISAM;
SELECT ( SELECT b FROM t1 LIMIT 1 ) AS sq FROM t2 LEFT JOIN t3 USING (pk);
sq
NULL
NULL
DROP TABLE t1, t2, t3;
#
# End of 10.4 tests # End of 10.4 tests
# #
...@@ -749,6 +749,17 @@ INSERT INTO t1 () VALUES (),(); ...@@ -749,6 +749,17 @@ INSERT INTO t1 () VALUES (),();
SELECT IF(0,t,NULL) AS f FROM t1 GROUP BY 'foo'; SELECT IF(0,t,NULL) AS f FROM t1 GROUP BY 'foo';
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-18145 Assertion `0' failed in Item::val_native upon SELECT subquery with timestamp
--echo #
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1),(2);
CREATE TABLE t3 (pk INT PRIMARY KEY, b TIMESTAMP) ENGINE=MyISAM;
SELECT ( SELECT b FROM t1 LIMIT 1 ) AS sq FROM t2 LEFT JOIN t3 USING (pk);
DROP TABLE t1, t2, t3;
--echo # --echo #
--echo # End of 10.4 tests --echo # End of 10.4 tests
......
...@@ -1084,7 +1084,7 @@ void Item_maxmin_subselect::no_rows_in_result() ...@@ -1084,7 +1084,7 @@ void Item_maxmin_subselect::no_rows_in_result()
*/ */
if (parsing_place != SELECT_LIST || const_item()) if (parsing_place != SELECT_LIST || const_item())
return; return;
value= (new (thd->mem_root) Item_null(thd))->get_cache(thd); value= get_cache(thd);
null_value= 0; null_value= 0;
was_values= 0; was_values= 0;
make_const(); make_const();
...@@ -1102,7 +1102,7 @@ void Item_singlerow_subselect::no_rows_in_result() ...@@ -1102,7 +1102,7 @@ void Item_singlerow_subselect::no_rows_in_result()
*/ */
if (parsing_place != SELECT_LIST || const_item()) if (parsing_place != SELECT_LIST || const_item())
return; return;
value= (new (thd->mem_root) Item_null(thd))->get_cache(thd); value= get_cache(thd);
reset(); reset();
make_const(); make_const();
} }
......
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