• evgen@moonbone.local's avatar
    Fixed bug#13575: SP funcs in select with distinct/group and order by can · c5493b63
    evgen@moonbone.local authored
    produce wrong data
    
    By default Item_sp_func::val_str() returns string from it's result_field 
    internal buffer. When grouping is present Item_copy_string is used to 
    store SP function result, but it doesn't additionally buffer the result.
    When the next record is read, internal buffer is overwritten, due to
    this Item_copy_string::val_str() will have wrong data. Thus producing
    weird query result.
    
    The Item_func_sp::val_str() now makes a copy of returned value to prevent
    occasional corruption.
    c5493b63
sp.test 118 KB