diff options
author | Igor Babaev <igor@askmonty.org> | 2022-03-25 11:04:56 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2022-03-25 14:14:51 -0700 |
commit | e048289e557315b068a15083267329c443faadd3 (patch) | |
tree | 90f709e81525616970b98da7b63771a3d0fb67e1 /mysql-test/main/opt_tvc.test | |
parent | 549a71e74b2fa494efcd79635a5db8af0d541f99 (diff) | |
download | mariadb-git-e048289e557315b068a15083267329c443faadd3.tar.gz |
MDEV-27937 Assertion failure when executing prepared statement with ? in IN list
This bug affected queries with IN predicates that contain parameter markers
in the value list. Such queries are executed via prepared statements.
The problem appeared only if the number of elements in the value list
was greater than the set value of the system variable
in_predicate_conversion_threshold.
The patch unconditionally prohibits conversion of an IN predicate to the
equivalent IN predicand if the value list of the IN predicate contains
parameters markers.
Approved by Oleksandr Byelkin <sanja@mariadb.com>
Diffstat (limited to 'mysql-test/main/opt_tvc.test')
-rw-r--r-- | mysql-test/main/opt_tvc.test | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/mysql-test/main/opt_tvc.test b/mysql-test/main/opt_tvc.test index e4e8c6d7919..f8469f22aa1 100644 --- a/mysql-test/main/opt_tvc.test +++ b/mysql-test/main/opt_tvc.test @@ -428,3 +428,29 @@ eval $query; drop table t1; SET @@in_predicate_conversion_threshold= default; +--echo # +--echo # MDEV-27937: Prepared statement with ? in the list if IN predicate +--echo # + +set in_predicate_conversion_threshold=2; + +create table t1 (id int, a int, b int); +insert into t1 values (1,3,30), (2,7,70), (3,1,10); + +prepare stmt from " +select * from t1 where a in (7, ?, 5, 1); +"; +execute stmt using 3; +deallocate prepare stmt; + +prepare stmt from " +select * from t1 where (a,b) in ((7,70), (3,?), (5,50), (1,10)); +"; +execute stmt using 30; +deallocate prepare stmt; + +drop table t1; + +set in_predicate_conversion_threshold=default; + +--echo # End of 10.3 tests |