• Alexey Kopytov's avatar
    Bug #53544: Server hangs during JOIN query in stored procedure · 6cf49743
    Alexey Kopytov authored
                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.
    
    mysql-test/r/join.result:
      Added a test case for bug #53544.
    mysql-test/t/join.test:
      Added a test case for bug #53544.
    sql/sql_select.cc:
      Make sure fix_name_res is reset on every loop iteration.
    6cf49743
sql_select.cc 549 KB