• Gleb Shchepa's avatar
    Bug#26020: User-Defined Variables are not consistent with · db1d38c9
    Gleb Shchepa authored
               columns data types
    
    The "SELECT @lastId, @lastId := Id FROM t" query returns
    different result sets depending on the type of the Id column
    (INT or BIGINT).
    
    Note: this fix doesn't cover the case when a select query
    references an user variable and stored function that
    updates a value of that variable, in this case a result
    is indeterminate.
    
    
    The server uses incorrect assumption about a constantness of
    an user variable value as a select list item: 
    
    The server caches a last query number where that variable
    was changed and compares this number with a current query
    number. If these numbers are different, the server guesses,
    that the variable is not updating in the current query, so
    a respective select list item is a constant. However, in some
    common cases the server updates cached query number too late.
    
    
    The server has been modified to memorize user variable
    assignments during the parse phase to take them into account
    on the next (query preparation) phase independently of the
    order of user variable references/assignments in a select
    item list.
    db1d38c9
item_func.h 47.2 KB