mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Fixed bug #49322.
When not-exists optimization was applied to a table that happened to be an inner table of two outer joins, one embedded into another, then setting the match flag for the embedding outer join on could be skipped. This caused generation of extra null complemented rows. Made sure that the match flags are set correctly in all cases when not-exists optimization is used.
This commit is contained in:
@@ -11738,6 +11738,7 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab,
|
||||
condition is true => a match is found.
|
||||
*/
|
||||
bool found= 1;
|
||||
bool use_not_exists_opt= 0;
|
||||
while (join_tab->first_unmatched && found)
|
||||
{
|
||||
/*
|
||||
@@ -11754,7 +11755,7 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab,
|
||||
for (JOIN_TAB *tab= first_unmatched; tab <= join_tab; tab++)
|
||||
{
|
||||
if (tab->table->reginfo.not_exists_optimize)
|
||||
return NESTED_LOOP_NO_MORE_ROWS;
|
||||
use_not_exists_opt= 1;
|
||||
/* Check all predicates that has just been activated. */
|
||||
/*
|
||||
Actually all predicates non-guarded by first_unmatched->found
|
||||
@@ -11787,6 +11788,9 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab,
|
||||
join_tab->first_unmatched= first_unmatched;
|
||||
}
|
||||
|
||||
if (use_not_exists_opt)
|
||||
return NESTED_LOOP_NO_MORE_ROWS;
|
||||
|
||||
/*
|
||||
It was not just a return to lower loop level when one
|
||||
of the newly activated predicates is evaluated as false
|
||||
|
||||
Reference in New Issue
Block a user