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

Fixed bug #18279: crash in the cases when on conditions are moved

out of a nested join to the on conditions for the nest.
The bug happened due to:
1. The function simplify_joins could change on expressions for nested joins.
   Yet modified on expressions were not saved in prep_on_expr.
2. On expressions were not restored for nested joins in 
   reinit_stmt_before_use.


mysql-test/r/join_nested.result:
  Added a test case for bug #18279.
mysql-test/t/join_nested.test:
  Added a test case for bug #18279.
sql/sql_prepare.cc:
  Fixed bug #18279.
  On expressions were not restored for nested joins in 
  reinit_stmt_before_use.
sql/sql_select.cc:
  Fixed bug #18279.
  The function simplify_joins could change on expressions for nested joins.
  Yet modified on expressions were not saved in prep_on_expr.
This commit is contained in:
unknown
2006-03-29 16:45:29 -08:00
parent c5ab0159e1
commit 9a02fede24
4 changed files with 123 additions and 5 deletions

View File

@ -7469,7 +7469,7 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top)
*/
if (table->on_expr)
{
Item *expr= table->prep_on_expr ? table->prep_on_expr : table->on_expr;
Item *expr= table->on_expr;
/*
If an on expression E is attached to the table,
check all null rejected predicates in this expression.
@ -7480,7 +7480,9 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top)
*/
expr= simplify_joins(join, &nested_join->join_list,
expr, FALSE);
table->prep_on_expr= table->on_expr= expr;
table->on_expr= expr;
if (!table->prep_on_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;