• Alexander Barkov's avatar
    MDEV-15420 Wrong result for CAST from TIME or DATETIME with zero integer part... · d0cc7a52
    Alexander Barkov authored
    MDEV-15420 Wrong result for CAST from TIME or DATETIME with zero integer part and non-zero microseconds to DECIMAL(X,Y)
    
    The loop in ull2dec() does not iterate if "from" is zero,
    so to->intg got erroneously set to 0 instead of 1.
    Because if this, my_decimal2seconds() wrote the fractional
    part into a wrong buf[x].
    
    Catching the special case with zero "from" and properly initialize "to"
    using decimal_make_zero().
    d0cc7a52
decimal.c 86.8 KB