• unknown's avatar
    Bug#19136: Crashing log-bin and uninitialized user variables in a derived table · 4ab4631b
    unknown authored
    The reason of the bug is in that `get_var_with_binlog' performs missed
    assingment of
    the variables as side-effect. Doing that it eventually calls
    `free_underlaid_joins' to pass as an argument `thd->lex->select_lex' of the lex
    which belongs to the user query, not 
    to one which is emulated i.e SET @var1:=NULL.
    
    
    `get_var_with_binlog' is refined to supply a temporary lex to sql_set_variables's stack.
    
    
    mysql-test/r/rpl_user_variables.result:
      results changed
    mysql-test/t/rpl_user_variables.test:
      a problematic query to be binlogged is added
    sql/item_func.cc:
      BUG#19136: Crashing log-bin and uninitialized user variables
      
      The reason of the bug is in that how `get_var_with_binlog' performs missed
      assingment of the variables: `free_underlaid_joins' gets as an argument `thd->lex->select_lex'
      which belongs to the user query, not to one which is emulated i.e SET @var1:=NULL.
      
      `get_var_with_binlog' is refined to supply a temporary lex to sql_set_variables's stack.
    4ab4631b
rpl_user_variables.test 2 KB