• kroki/tomash@moonlight.intranet's avatar
    BUG#21081: SELECT inside stored procedure returns wrong results · 0bdc597b
    kroki/tomash@moonlight.intranet authored
    Re-execution of a parametrized prepared statement or a stored routine
    with a SELECT that use LEFT JOIN with second table having only one row
    could yield incorrect result.
    
    The problem appeared only for left joins with second table having only
    one row (aka const table) and equation conditions in ON or WHERE clauses
    that depend on the argument passed.  Once the condition was false for
    second const table, a NULL row was created for it, and any field involved
    got NULL-value flag, which then was never reset.
    
    The cause of the problem was that Item_field::null_value could be set
    without being reset for re-execution.  The solution is to reset
    Item_field::null_value in Item_field::cleanup().
    0bdc597b
ps.test 38.4 KB