Skip to content
  • Knut Anders Hatlen's avatar
    6d986534
    Bug#32591589: ASSERTION `DIGITS <= DECIMAL_INT_PART()' FAILED|SQL/ITEM_FUNC.CC · 6d986534
    Knut Anders Hatlen authored
    Casting from DECIMAL to SIGNED INTEGER could hit an assertion failure
    because the result had more digits than the metadata of
    Item_typecast_signed indicated it would have. This happened because
    the decimal value is rounded when it's converted to an integer, and
    Item_typecast_signed did not take into account that the rounding might
    increase the number of digits in the integer part of the decimal
    value. For example when rounding 9.9 to 10.
    
    Fixed by removing the logic that tried to compute a minimal maximum
    length for the result of the cast, and instead use the default set by
    the parent class, Item_int_func. That default is the maximum width of
    a 64-bit integer, which should be safe regardless of the input value.
    
    Change-Id: I1670182c632b475eba9face241bcbee78df51fc8
    6d986534
    Bug#32591589: ASSERTION `DIGITS <= DECIMAL_INT_PART()' FAILED|SQL/ITEM_FUNC.CC
    Knut Anders Hatlen authored
    Casting from DECIMAL to SIGNED INTEGER could hit an assertion failure
    because the result had more digits than the metadata of
    Item_typecast_signed indicated it would have. This happened because
    the decimal value is rounded when it's converted to an integer, and
    Item_typecast_signed did not take into account that the rounding might
    increase the number of digits in the integer part of the decimal
    value. For example when rounding 9.9 to 10.
    
    Fixed by removing the logic that tried to compute a minimal maximum
    length for the result of the cast, and instead use the default set by
    the parent class, Item_int_func. That default is the maximum width of
    a 64-bit integer, which should be safe regardless of the input value.
    
    Change-Id: I1670182c632b475eba9face241bcbee78df51fc8
Loading