mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
BUG#20492: Subsequent calls to stored procedure yield incorrect result
if join is used For procedures with selects that use complicated joins with ON expression re-execution could erroneously ignore this ON expression, giving incorrect result. The problem was that optimized ON expression wasn't saved for re-execution. The solution is to properly save it. mysql-test/r/sp.result: Add result for bug#20492: Subsequent calls to stored procedure yield incorrect result if join is used. mysql-test/t/sp.test: Add test case for bug#20492: Subsequent calls to stored procedure yield incorrect result if join is used. sql/sql_select.cc: Save modified ON expression for re-execution.
This commit is contained in:
@ -7427,9 +7427,14 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top)
|
||||
*/
|
||||
expr= simplify_joins(join, &nested_join->join_list,
|
||||
expr, FALSE);
|
||||
table->on_expr= expr;
|
||||
if (!table->prep_on_expr)
|
||||
|
||||
if (!table->prep_on_expr || expr != table->on_expr)
|
||||
{
|
||||
DBUG_ASSERT(expr);
|
||||
|
||||
table->on_expr= expr;
|
||||
table->prep_on_expr= expr->copy_andor_structure(join->thd);
|
||||
}
|
||||
}
|
||||
nested_join->used_tables= (table_map) 0;
|
||||
nested_join->not_null_tables=(table_map) 0;
|
||||
@ -7439,7 +7444,7 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(table->prep_on_expr))
|
||||
if (!table->prep_on_expr)
|
||||
table->prep_on_expr= table->on_expr;
|
||||
used_tables= table->table->map;
|
||||
if (conds)
|
||||
|
Reference in New Issue
Block a user