mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
BUG#920713: Wrong result (missing rows) with firstmatch+BNL, IN subquery, ...
- Disable use of join cache when we're using FirstMatch strategy, and the join order is such that subquery's inner tables are interleaved with outer. Join buffering code is incapable of handling such join orders. - The testcase requires use of @@debug_optimizer_prefer_join_prefix to hit the bug, but I'm pushing it anyway (including the mention of the variable in .test file), so that it can be found and enabled when/if we get something comparable in the main tree.
This commit is contained in:
@ -9153,6 +9153,9 @@ uint check_join_cache_usage(JOIN_TAB *tab,
|
||||
|
||||
if (tab->use_quick == 2)
|
||||
goto no_join_cache;
|
||||
|
||||
if (tab->table->map & join->complex_firstmatch_tables)
|
||||
goto no_join_cache;
|
||||
|
||||
/*
|
||||
Don't use join cache if we're inside a join tab range covered by LooseScan
|
||||
@ -9363,7 +9366,7 @@ void check_join_cache_usage_for_tables(JOIN *join, ulonglong options,
|
||||
{
|
||||
tab->used_join_cache_level= join->max_allowed_join_cache_level;
|
||||
}
|
||||
|
||||
|
||||
uint idx= join->const_tables;
|
||||
for (tab= first_linear_tab(join, WITHOUT_CONST_TABLES);
|
||||
tab;
|
||||
@ -9448,6 +9451,8 @@ make_join_readinfo(JOIN *join, ulonglong options, uint no_jbuf_after)
|
||||
bool statistics= test(!(join->select_options & SELECT_DESCRIBE));
|
||||
bool sorted= 1;
|
||||
|
||||
join->complex_firstmatch_tables= table_map(0);
|
||||
|
||||
if (!join->select_lex->sj_nests.is_empty() &&
|
||||
setup_semijoin_dups_elimination(join, options, no_jbuf_after))
|
||||
DBUG_RETURN(TRUE); /* purecov: inspected */
|
||||
|
Reference in New Issue
Block a user