• unknown's avatar
    BUG#21081: SELECT inside stored procedure returns wrong results · 7efdc62f
    unknown 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().
    
    
    mysql-test/r/ps.result:
      Add result for bug#21081: SELECT inside stored procedure returns wrong
      results.
    mysql-test/t/ps.test:
      Add test case for bug#21081: SELECT inside stored procedure returns wrong
      results.
    sql/item.cc:
      Reset Item_field::null_value flag for re-execution.
    7efdc62f
ps.result 39.1 KB