• cbell/Chuck@mysql_cab_desk.'s avatar
    Bug #25543 Replication of wrong values if using rand() in stored procedure · d44eb9f0
    cbell/Chuck@mysql_cab_desk. authored
    When rand() is called multiple times inside a stored procedure, the server does 
    not binlog the correct random seed values.
    
    This patch corrects the problem by resetting rand_used= 0 in 
    THD::cleanup_after_query() allowing the system to save the random seeds if needed
    for each command in a stored procedure body.
    
    However, rand_used is not reset if executing in a stored function or trigger 
    because these operations are binlogged by call and thus only the calling statement
    need detect the call to rand() made by its substatements. These substatements must 
    not set rand_used to 0 because it would remove the detection of rand() by the 
    calling statement.
    d44eb9f0
sql_class.cc 58.3 KB