• Alexander Barkov's avatar
    MDEV-23366 ROUND(18446744073709551615,rand()*0) returns a wrong result · 9840bb21
    Alexander Barkov authored
    Changing that in case of *INT and hex hybrid input:
    - ROUND(x,NULL) creates a column with the same type as x.
      The old code created a DOUBLE column, which was not relevant at all.
      This change simplifies the code a lot.
    
    - ROUND(x,non_constant) creates a column of the INT, BIGINT or DECIMAL
      data type (depending on the exact type of x).
      The old code created a column of the DOUBLE data type,
      which lead to precision loss. Hence MDEV-23366.
    
    - ROUND(bigint_30,negative_constant) creates a column of the DECIMAL(30,0)
      data type. The old code created DECIMAL(29,0), which looked strange:
      the data type promoted to a higher one, but max length reduced.
      Now the length attribute is preserved.
    9840bb21
item_func.h 108 KB