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

FLOAT(53,0) badly handles out-of-range values

    XMLWordPrintable

Details

    Description

      I create a table with a FLOAT column and insert a value outside of the float supported range:

      CREATE OR REPLACE TABLE t1(c1 FLOAT NOT NULL);
      INSERT IGNORE INTO t1 VALUES (1e+40);
      SELECT c1 FROM t1;
      

      +------------+
      | c1         |
      +------------+
      | 3.40282e38 |
      +------------+
      

      Looks good so far. It truncated the value to the maximum supported FLOAT value, and a corresponding warning was issued.

      Now I do the same with a column of the data type FLOAT(53,0):

      CREATE OR REPLACE TABLE t1(c1 FLOAT(53,0) NOT NULL);
      INSERT IGNORE INTO t1 VALUES (1e+40);
      SELECT c1 FROM t1;
      

      +----+
      | c1 |
      +----+
      |  0 |
      +----+
      

      It silently truncated the value to 0. This is wrong. The expected value should be a huge FLOAT value with a warning.

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.