mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-12580 Wrong query result in join when using an index (Version > "10.2.3")
JOIN_TAB::remove_redundant_bnl_scan_conds() removes select_cond
from a JOIN_TAB if join cache is enabled, and tab->cache_select->cond
is the equal to tab->select_cond.
But after 8d99166c69
the code to initialize join cache was moved
to happen much later than JOIN_TAB::remove_redundant_bnl_scan_conds(),
and that code might, under certain conditions, revert to *not* using
join cache (set_join_cache_denial()).
If JOIN_TAB::remove_redundant_bnl_scan_conds() removes the WHERE
condition from the JOIN_TAB and later set_join_cache_denial() disables
join cache, we end up with no WHERE condition at all.
Fix: move JOIN_TAB::remove_redundant_bnl_scan_conds() to happen
after all possible set_join_cache_denial() calls.
This commit is contained in:
@ -3900,6 +3900,18 @@ SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.user WHERE password_expired =
|
||||
|
||||
set join_cache_level=default;
|
||||
|
||||
#
|
||||
# MDEV-12580 Wrong query result in join when using an index (Version > "10.2.3")
|
||||
#
|
||||
create table t1 (c1 date not null, key (c1)) engine=innodb;
|
||||
insert t1 values ('2017-12-27');
|
||||
create table t2 (pk int, f1 int, f2 int);
|
||||
insert t2 values (4,1,1), (6,1,1);
|
||||
set join_buffer_size = 222222208;
|
||||
select f2 from t2,t1 where f2 = 0;
|
||||
drop table t1, t2;
|
||||
set join_buffer_size = default;
|
||||
|
||||
# The following command must be the last one the file
|
||||
# this must be the last command in the file
|
||||
set @@optimizer_switch=@save_optimizer_switch;
|
||||
|
Reference in New Issue
Block a user