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

Wrong value on conversion of '1.0.0' to INT

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.6, 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5(EOL), 10.7(EOL), 10.8(EOL), 10.9(EOL)
    • 10.6, 10.11, 11.4, 11.8, 12.0(EOL)
    • Data types
    • None

    Description

      This script:

      SET sql_mode='';
      CREATE OR REPLACE TABLE t1 (a INT);
      INSERT INTO t1 VALUES ('1.0.0');
      SELECT * FROM t1;
      

      returns the following output:

      Query OK, 1 row affected, 1 warning (0.001 sec)
       
      +------+
      | a    |
      +------+
      |   10 |
      +------+
      

      The value of 10 is wrong. The expected result is 1.

      The problem is not repeatable with DOUBLE or DECIMAL data types.
      The problem is not repeatable with explicit CAST('1.0.0' AS UNSIGNED)

      Attachments

        Activity

          People

            bar Alexander Barkov
            bar Alexander Barkov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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