1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

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>
This commit is contained in:
Igor Babaev
2021-02-10 23:38:52 -08:00
parent 59eda73eff
commit da88e1ec12
5 changed files with 113 additions and 7 deletions

View File

@ -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