summaryrefslogtreecommitdiff
path: root/mysql-test/main/table_value_constr.test
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2021-02-10 23:38:52 -0800
committerIgor Babaev <igor@askmonty.org>2021-02-10 23:38:52 -0800
commitda88e1ec12b0ba39552bf54367c1bb3b89eac4a8 (patch)
tree6c1f254615b8673ec149010f165b76fb787483b1 /mysql-test/main/table_value_constr.test
parent59eda73eff1a22ac0373d818bc802c05e82b5449 (diff)
downloadmariadb-git-da88e1ec12b0ba39552bf54367c1bb3b89eac4a8.tar.gz
MDEV-24840 Crash caused by query with IN subquery containing union
of two table value costructors This bug affected queries with a [NOT] IN/ANY/ALL subquery whose top level unit contained several table value constructors. The problem appeared because the code of the function Item_subselect::fix_fields() that was responsible for wrapping table value constructors encountered at the top level unit of a [NOT] IN/ANY/ALL subquery did not take into account that the chain of the select objects comprising the unit were not immutable. Approved by Oleksandr Byelkin <sanja@mariadb.com>
Diffstat (limited to 'mysql-test/main/table_value_constr.test')
-rw-r--r--mysql-test/main/table_value_constr.test33
1 files changed, 33 insertions, 0 deletions
diff --git a/mysql-test/main/table_value_constr.test b/mysql-test/main/table_value_constr.test
index e8697bef589..bac85ff75cc 100644
--- a/mysql-test/main/table_value_constr.test
+++ b/mysql-test/main/table_value_constr.test
@@ -1401,4 +1401,37 @@ values ((select min(a), max(b) from t1));
drop table t1;
+--echo #
+--echo # MDEV-24840: union of TVCs in IN subquery
+--echo #
+
+create table t1 (a int) engine=myisam;
+insert into t1 values (3), (7), (1);
+
+let $q=
+select a from t1 where a in (values (7) union values (8));
+eval $q;
+eval explain extended $q;
+eval prepare stmt from "$q";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+let $q=
+select a from t1 where a not in (values (7) union values (8));
+eval $q;
+eval explain extended $q;
+
+let $q=
+select a from t1 where a < all(values (7) union values (8));
+eval $q;
+eval explain extended $q;
+
+let $q=
+select a from t1 where a >= any(values (7) union values (8));
+eval $q;
+eval explain extended $q;
+
+drop table t1;
+
--echo End of 10.3 tests