Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-20732

max_char_length() returns value that is too small for a string returned by FORMAT() with doubles in scientific notation

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 10.4
    • Fix Version/s: 10.4.9
    • Component/s: Data types
    • Labels:
      None

      Description

      Consider the example:

      MariaDB [test]> CREATE OR REPLACE TABLE t1 AS SELECT FORMAT(1e300,2);
      ERROR 1406 (22001): Data too long for column 'FORMAT(1e300,2)' at row 1
      

      There is an assumption that doubles represented as strings couldn't take more then 22 chars. This is incorrect if a big double is sent into FORMAT() function. However the expression args[0]->max_char_length() that is called inside Item_func_format::fix_length_and_dec() returns 22 and this causes the error.

      This is also relevant for ColumnStore.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                drrtuy Roman
                Reporter:
                drrtuy Roman
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: