summaryrefslogtreecommitdiff
path: root/mysql-test/r/subselect_sj.result
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2019-03-14 17:41:35 -0700
committerIgor Babaev <igor@askmonty.org>2019-03-14 17:41:35 -0700
commit0dd12b4f2a72245a0fb491685c172a7b0e48cbc5 (patch)
tree09809f3b930995e8001a8b8c32f8e0170a0e4716 /mysql-test/r/subselect_sj.result
parent8024f8c6b86b204c3475e562587640cf2b141683 (diff)
downloadmariadb-git-0dd12b4f2a72245a0fb491685c172a7b0e48cbc5.tar.gz
MDEV-18896 Crash in convert_join_subqueries_to_semijoins
If an IN-subquery is used in a table-less select the current code should never consider it as candidate for semi-join optimizations. Yet the function check_and_do_in_subquery_rewrites() improperly checked the property "to be a table-less select". As a result such select in IN subquery was used in INSERT .. SELECT then the IN subquery by mistake was registered as a semi-join subquery and convert_subq_to_sj() was called for it. However the code of this function does not assume that the parent select of the subquery could be a table-less select.
Diffstat (limited to 'mysql-test/r/subselect_sj.result')
-rw-r--r--mysql-test/r/subselect_sj.result7
1 files changed, 7 insertions, 0 deletions
diff --git a/mysql-test/r/subselect_sj.result b/mysql-test/r/subselect_sj.result
index 519d53eb98f..73c620b2973 100644
--- a/mysql-test/r/subselect_sj.result
+++ b/mysql-test/r/subselect_sj.result
@@ -3178,5 +3178,12 @@ EXECUTE stmt;
a
drop view v3;
drop table t1,t2,t3;
+#
+# MDEV-18896: IN subquery in WHERE of a table-less query used for INSERT
+#
+create table t1 (a1 varchar(25));
+create table t2 (a2 varchar(25)) ;
+insert into t1 select 'xxx' from dual where 'xxx' in (select a2 from t2);
+drop table t1,t2;
# End of 5.5 test
set optimizer_switch=@subselect_sj_tmp;