• Dmitry Shulga's avatar
    Fixed Bug#12621017 - CRASH IF A SP VARIABLE IS USED IN THE LIMIT CLAUSE OF A · 644db664
    Dmitry Shulga authored
    SET STATEMENT.
    
    Server built with debug asserts, without debug crashes if a user tries
    to run a stored procedure that constains query with subquery that include
    either LIMIT or LIMIT OFFSET clauses.
    
    The problem was that Item::fix_fields() was not called for the items
    representing LIMIT or OFFSET clauses.
    
    The solution is to call Item::fix_fields() right before evaluation in
    st_select_lex_unit::set_limit().
    
    mysql-test/r/sp.result:
      Added testcase result for bug#12621017. Updated testcase result for
      bug 11918.
    mysql-test/t/sp.test:
      Added testcase for bug#12621017. Addressed review comments for Bug 11918
      (added tests for use LIMIT at stored function).
    sql/item.h:
      Addressed review comments for Bug 11918.
    sql/share/errmsg-utf8.txt:
      Addressed review comments for Bug 11918.
    sql/sp_head.cc:
      Addressed review comments for Bug 11918.
    sql/sql_lex.cc:
      Added call fix_fields() for item just before its evaluation.
    sql/sql_yacc.yy:
      Addressed review comments for Bug 11918.
    644db664
sp_head.cc 114 KB