diff options
author | Alexey Kopytov <Alexey.Kopytov@Sun.com> | 2010-08-26 14:13:02 +0400 |
---|---|---|
committer | Alexey Kopytov <Alexey.Kopytov@Sun.com> | 2010-08-26 14:13:02 +0400 |
commit | 6c6a3e8f44a160b6b1a9eac95a08d36d22666679 (patch) | |
tree | d10c150611af90c3997fe141f32ecf8ae51048c4 /sql/sql_select.cc | |
parent | 947c7f3029dea620429e4a56a26bbde80817bdc5 (diff) | |
download | mariadb-git-6c6a3e8f44a160b6b1a9eac95a08d36d22666679.tar.gz |
Bug #53544: Server hangs during JOIN query in stored procedure
called twice in a row
Queries with nested joins could cause an infinite loop in the
server when used from SP/PS.
When flattening nested joins, simplify_joins() tracks if the
name resolution list needs to be updated by setting
fix_name_res to TRUE if the current loop iteration has done any
transformations to the join table list. The problem was that
the flag was not reset before the next loop iteration leading
to unnecessary "fixing" of the name resolution list which in
turn could lead to a loop (i.e. circularly-linked part) in that
list. This was causing problems on subsequent execution when
used together with stored procedures or prepared statements.
Fixed by making sure fix_name_res is reset on every loop
iteration.
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index a77c270f709..ed5123817bf 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -8885,10 +8885,10 @@ 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; - bool fix_name_res= FALSE; li.rewind(); while ((table= li++)) { + bool fix_name_res= FALSE; nested_join= table->nested_join; if (nested_join && !table->on_expr) { |