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

    XMLWordPrintable

Details

    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

              drrtuy Roman
              drrtuy Roman
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.