diff options
author | unknown <timour@askmonty.org> | 2012-12-19 15:56:57 +0200 |
---|---|---|
committer | unknown <timour@askmonty.org> | 2012-12-19 15:56:57 +0200 |
commit | e99aa91e90adfd54cc1f460dd8cdd19614f30abc (patch) | |
tree | 81d722dbf846e83e0c68c80266e5c0a7e52bcc69 /mysql-test/t/subselect4.test | |
parent | 0aad592f49f0fb790f712aa6a644653cf9a0218f (diff) | |
download | mariadb-git-e99aa91e90adfd54cc1f460dd8cdd19614f30abc.tar.gz |
MDEV-3928: Assertion `example' failed in Item_cache::is_expensive_processor with a 2-level IN subquery
Analysis:
The following call stack shows that it is possible to set Item_cache::value_cached, and the relevant value
without setting Item_cache::example.
#0 Item_cache_temporal::store_packed at item.cc:8395
#1 get_datetime_value at item_cmpfunc.cc:915
#2 resolve_const_item at item.cc:7987
#3 propagate_cond_constants at sql_select.cc:12264
#4 propagate_cond_constants at sql_select.cc:12227
#5 optimize_cond at sql_select.cc:13026
#6 JOIN::optimize at sql_select.cc:1016
#7 st_select_lex::optimize_unflattened_subqueries at sql_lex.cc:3161
#8 JOIN::optimize_unflattened_subqueries at opt_subselect.cc:4880
#9 JOIN::optimize at sql_select.cc:1554
The fix is to set Item_cache_temporal::example even when the value is
set directly by Item_cache_temporal::store_packed. This makes the
Item_cache_temporal object consistent.
Diffstat (limited to 'mysql-test/t/subselect4.test')
-rw-r--r-- | mysql-test/t/subselect4.test | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test index c9fe4f3d3d5..5e1f3db2f4a 100644 --- a/mysql-test/t/subselect4.test +++ b/mysql-test/t/subselect4.test @@ -1858,5 +1858,33 @@ drop table t1, t2; set optimizer_switch=@subselect4_tmp; +--echo # +--echo # MDEV-3928 Assertion `example' failed in Item_cache::is_expensive_processor with a 2-level IN subquery +--echo # + +CREATE TABLE t1 (a1 INT, b1 TIME) ENGINE=MyISAM; +INSERT INTO t1 VALUES (4,'21:22:34'),(6,'10:50:38'); + +CREATE TABLE t2 (a2 INT, b2 TIME) ENGINE=MyISAM; +INSERT INTO t2 VALUES (8, '06:17:39'); + +CREATE TABLE t3 (a3 INT, b3 TIME) ENGINE=MyISAM; +INSERT INTO t3 VALUES (1,'00:00:01'),(7,'00:00:02'); + +EXPLAIN +SELECT * FROM t1 WHERE a1 IN ( + SELECT a2 FROM t2 WHERE a2 IN ( + SELECT a3 FROM t3 WHERE b2 = b1 AND b2 <= b1 ORDER BY b3 + ) +); + +SELECT * FROM t1 WHERE a1 IN ( + SELECT a2 FROM t2 WHERE a2 IN ( + SELECT a3 FROM t3 WHERE b2 = b1 AND b2 <= b1 ORDER BY b3 + ) +); + +drop table t1, t2, t3; + SET optimizer_switch= @@global.optimizer_switch; set @@tmp_table_size= @@global.tmp_table_size; |