diff options
author | unknown <igor@rurik.mysql.com> | 2006-03-29 16:45:29 -0800 |
---|---|---|
committer | unknown <igor@rurik.mysql.com> | 2006-03-29 16:45:29 -0800 |
commit | 9a02fede24e99c6bfd61830a618ea0086ffe24fb (patch) | |
tree | 7015ecca1a840683624b53321bb98120f0fc23da /sql/sql_prepare.cc | |
parent | c5ab0159e19d607246d73951e14cf3d42479c7b9 (diff) | |
download | mariadb-git-9a02fede24e99c6bfd61830a618ea0086ffe24fb.tar.gz |
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.
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r-- | sql/sql_prepare.cc | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 0f4ae04962b..ac0687b488d 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -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; |