1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge of fix for Bug#11765810.

This commit is contained in:
Martin Hansson
2012-02-07 17:32:04 +01:00
3 changed files with 115 additions and 10 deletions

View File

@ -9082,11 +9082,9 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top)
}
/* Flatten nested joins that can be flattened. */
TABLE_LIST *right_neighbor= NULL;
li.rewind();
while ((table= li++))
{
bool fix_name_res= FALSE;
nested_join= table->nested_join;
if (nested_join && !table->on_expr)
{
@ -9098,15 +9096,7 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top)
tbl->join_list= table->join_list;
}
li.replace(nested_join->join_list);
/* Need to update the name resolution table chain when flattening joins */
fix_name_res= TRUE;
table= *li.ref();
}
if (fix_name_res)
table->next_name_resolution_table= right_neighbor ?
right_neighbor->first_leaf_for_name_resolution() :
NULL;
right_neighbor= table;
}
DBUG_RETURN(conds);
}