Details
-
Bug
-
Status: Closed (View Workflow)
-
Blocker
-
Resolution: Fixed
-
10.3.3
-
None
Description
If the system variable @@in_subquery_conversion_threshold is set to a small enough number then queries with NOT IN predicate in most cases return wrong result sets.
The following test case demonstrate this:
create table t1 (a int, b int);
|
insert into t1 values
|
(1,2), (4,6), (9,7),(1,1), (2,5), (7,8);
|
|
select * from t1
|
where (a,b) not in ((1,2),(8,9), (5,1));
|
|
set @@in_subquery_conversion_threshold= 2;
|
select * from t1
|
where (a,b) not in ((1,2),(8,9), (5,1));
|
When running this test we have:
MariaDB [test]>
|
MariaDB [test]> select * from t1
|
-> where (a,b) not in ((1,2),(8,9), (5,1));
|
+------+------+
|
| a | b |
|
+------+------+
|
| 4 | 6 |
|
| 9 | 7 |
|
| 1 | 1 |
|
| 2 | 5 |
|
| 7 | 8 |
|
+------+------+
|
|
MariaDB [test]> set @@in_subquery_conversion_threshold= 2;
|
|
MariaDB [test]> select * from t1
|
-> where (a,b) not in ((1,2),(8,9), (5,1));
|
+------+------+
|
| a | b |
|
+------+------+
|
| 1 | 2 |
|
+------+------+
|
Attachments
Issue Links
- is caused by
-
MDEV-12176 Transform [NOT] IN predicate with long list of values INTO [NOT] IN subquery.
-
- Closed
-
- relates to
-
MDEV-14835 Server crashes in strlen / Field_iterator_table::create_item when IN list reaches in_predicate_conversion_threshold
-
- Closed
-
Activity
Field | Original Value | New Value |
---|---|---|
Description |
If the system variable @@in_subquery_conversion_threshold is set to a small enough number then queries with NOT IN predicate may return wrong result sets.
The following test case demonstrate this: {noformat} create table t1 (a int, b int); insert into t1 values (1,2), (4,6), (9,7),(1,1), (2,5), (7,8); select * from t1 where (a,b) not in ((1,2),(8,9), (5,1)); set @@in_subquery_conversion_threshold= 2; select * from t1 where (a,b) not in ((1,2),(8,9), (5,1)); {noformat} When running this test we have: {noformat} MariaDB [test]> MariaDB [test]> select * from t1 -> where (a,b) not in ((1,2),(8,9), (5,1)); +------+------+ | a | b | +------+------+ | 4 | 6 | | 9 | 7 | | 1 | 1 | | 2 | 5 | | 7 | 8 | +------+------+ MariaDB [test]> set @@in_subquery_conversion_threshold= 2; MariaDB [test]> select * from t1 -> where (a,b) not in ((1,2),(8,9), (5,1)); +------+------+ | a | b | +------+------+ | 1 | 2 | +------+------+ |
If the system variable @@in_subquery_conversion_threshold is set to a small enough number then queries with NOT IN predicate may return wrong result sets.
The following test case demonstrate this: {noformat} create table t1 (a int, b int); insert into t1 values (1,2), (4,6), (9,7),(1,1), (2,5), (7,8); select * from t1 where (a,b) not in ((1,2),(8,9), (5,1)); set @@in_subquery_conversion_threshold= 2; select * from t1 where (a,b) not in ((1,2),(8,9), (5,1)); {noformat} When running this test we have: {noformat} MariaDB [test]> MariaDB [test]> select * from t1 -> where (a,b) not in ((1,2),(8,9), (5,1)); +------+------+ | a | b | +------+------+ | 4 | 6 | | 9 | 7 | | 1 | 1 | | 2 | 5 | | 7 | 8 | +------+------+ MariaDB [test]> set @@in_subquery_conversion_threshold= 2; MariaDB [test]> select * from t1 -> where (a,b) not in ((1,2),(8,9), (5,1)); +------+------+ | a | b | +------+------+ | 1 | 2 | +------+------+ {noformat} |
Affects Version/s | 10.3.3 [ 22644 ] | |
Affects Version/s | 10.3 [ 22126 ] |
Fix Version/s | 10.3 [ 22126 ] |
Status | Open [ 1 ] | Confirmed [ 10101 ] |
Link |
This issue is caused by |
Description |
If the system variable @@in_subquery_conversion_threshold is set to a small enough number then queries with NOT IN predicate may return wrong result sets.
The following test case demonstrate this: {noformat} create table t1 (a int, b int); insert into t1 values (1,2), (4,6), (9,7),(1,1), (2,5), (7,8); select * from t1 where (a,b) not in ((1,2),(8,9), (5,1)); set @@in_subquery_conversion_threshold= 2; select * from t1 where (a,b) not in ((1,2),(8,9), (5,1)); {noformat} When running this test we have: {noformat} MariaDB [test]> MariaDB [test]> select * from t1 -> where (a,b) not in ((1,2),(8,9), (5,1)); +------+------+ | a | b | +------+------+ | 4 | 6 | | 9 | 7 | | 1 | 1 | | 2 | 5 | | 7 | 8 | +------+------+ MariaDB [test]> set @@in_subquery_conversion_threshold= 2; MariaDB [test]> select * from t1 -> where (a,b) not in ((1,2),(8,9), (5,1)); +------+------+ | a | b | +------+------+ | 1 | 2 | +------+------+ {noformat} |
If the system variable @@in_subquery_conversion_threshold is set to a small enough number then queries with NOT IN predicate in most cases return wrong result sets.
The following test case demonstrate this: {noformat} create table t1 (a int, b int); insert into t1 values (1,2), (4,6), (9,7),(1,1), (2,5), (7,8); select * from t1 where (a,b) not in ((1,2),(8,9), (5,1)); set @@in_subquery_conversion_threshold= 2; select * from t1 where (a,b) not in ((1,2),(8,9), (5,1)); {noformat} When running this test we have: {noformat} MariaDB [test]> MariaDB [test]> select * from t1 -> where (a,b) not in ((1,2),(8,9), (5,1)); +------+------+ | a | b | +------+------+ | 4 | 6 | | 9 | 7 | | 1 | 1 | | 2 | 5 | | 7 | 8 | +------+------+ MariaDB [test]> set @@in_subquery_conversion_threshold= 2; MariaDB [test]> select * from t1 -> where (a,b) not in ((1,2),(8,9), (5,1)); +------+------+ | a | b | +------+------+ | 1 | 2 | +------+------+ {noformat} |
Status | Confirmed [ 10101 ] | In Progress [ 3 ] |
Priority | Major [ 3 ] | Blocker [ 1 ] |
Fix Version/s | 10.3.3 [ 22644 ] | |
Fix Version/s | 10.3 [ 22126 ] | |
Resolution | Fixed [ 1 ] | |
Status | In Progress [ 3 ] | Closed [ 6 ] |
Link |
This issue relates to |
Workflow | MariaDB v3 [ 83621 ] | MariaDB v4 [ 153115 ] |
The parameter in_subquery_conversion_threshold was introduced in
MDEV-12176.