1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +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

@@ -2126,11 +2126,17 @@ void reinit_stmt_before_use(THD *thd, LEX *lex)
/* Reset is_schema_table_processed value(needed for I_S tables */
tables->is_schema_table_processed= FALSE;
if (tables->prep_on_expr)
TABLE_LIST *embedded; /* The table at the current level of nesting. */
TABLE_LIST *embedding= tables; /* The parent nested table reference. */
do
{
tables->on_expr= tables->prep_on_expr->copy_andor_structure(thd);
tables->on_expr->cleanup();
embedded= embedding;
if (embedded->prep_on_expr)
embedded->on_expr= embedded->prep_on_expr->copy_andor_structure(thd);
embedding= embedded->embedding;
}
while (embedding &&
embedding->nested_join->join_list.head() == embedded);
}
lex->current_select= &lex->select_lex;