• Michael Widenius's avatar
    Fixed MDEV-16512, crashing on re-execution of failing SP · 937c1931
    Michael Widenius authored
    MDEV-16512 Server crashes in find_field_in_table_ref on 2nd
    execution of SP referring to non-existing field
    
    Problem was in the natural join code that it changed TABLE_LIST and
    Item_fields but didn't restore changed things if things goes wrong
    and was not able to re-execute after failure.
    Some of the problems could have been avoided if we would have run
    fix_fields before doing natural join transformations.
    
    Fixed by marking functions complete AFTER they had executed, instead at
    start.
    I had also to change some tests that checked if Item_fields are usable.
    
    This doesn't fix all known problems, but at least avoids some crashes.
    What should be done in the near future is to mark the statement in the SP
    as 'not re-executable' and force a reparse of it on next execution.
    
    Reviewer: Sergei Petrunia <psergey@askmonty.org>
    937c1931
table.cc 204 KB