• Ramil Kalimullin's avatar
    Fix for bug#39182: Binary log producing incompatible character set query · d3e317d1
    Ramil Kalimullin authored
    from stored procedure. 
    
    Problem: we replace all references to local variables in stored procedures     
    with NAME_CONST(name, value) logging to the binary log. However, if the
    value's collation differs we might get an 'illegal mix of collation'           
    error as we don't pass the collation to the function.
    
    Fix: pass the value's collation to NAME_CONST().
    
    Note: actually we should pass to NAME_CONST() the value's derivation as well.
    It's impossible without the parser modifying. Now we always set the 
    derivation to DERIVATION_IMPLICIT, the same as local variables have.
    
    
    mysql-test/r/binlog.result:
      Fix for bug#39182: Binary log producing incompatible character set query
      from stored procedure.
        - test result.
    mysql-test/r/ctype_cp932_binlog.result:
      Fix for bug#39182: Binary log producing incompatible character set query
      from stored procedure.
        - results adjusted.
    mysql-test/r/rpl_sp.result:
      Fix for bug#39182: Binary log producing incompatible character set query
      from stored procedure.
        - results adjusted.
    mysql-test/t/binlog.test:
      Fix for bug#39182: Binary log producing incompatible character set query
      from stored procedure.
        - test case.
    sql/item.cc:
      Fix for bug#39182: Binary log producing incompatible character set query
      from stored procedure.
        - allow NAME_CONST() to get _charset'foo' COLLATE 'bar' strings
      (see Item_func_set_collation).
    sql/sp_head.cc:
      Fix for bug#39182: Binary log producing incompatible character set query
      from stored procedure. 
        - pass the value's collation to NAME_CONST().
    d3e317d1
item.cc 193 KB