• Neeraj Bisht's avatar
    Bug#11745891 - LAST_INSERT(ID) DOES NOT SUPPORT BIGINT UNSIGNED · d974ea7f
    Neeraj Bisht authored
    Problem:-
    using last_insert_id() on an auto_incremented bigint unsigned does
    not work for values which are greater than max-bigint-signed.
    
    Analysis:-
    last_insert_id() returns the first auto_incremented value for a column
    and an auto_incremented value can have only positive values.
    
    In our code, when we are initializing a last_insert_id object, we are
    taking it as a signed BIGINT, So when the auto_incremented value reaches
    greater than max signed bigint, last_insert_id gives negative result.
    
    Solution:
    When we are fetching the value from last_insert_id, We are setting the 
    unsigned_flag, so that it take only unsigned BIGINT value.
    d974ea7f
item_func.h 53.1 KB