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

Wrong result for CAST(9999999999999999999.0)

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 10.0, 10.1, 10.2
    • 10.4.5
    • Data types
    • None
    • 10.1.15, 10.2.2-1

    Description

      SELECT CAST(9999999999999999999e0 AS UNSIGNED) AS c1, CAST(9999999999999999999.0 AS UNSIGNED) AS c2;
      

      returns

      +---------------------+---------------------+
      | c1                  | c2                  |
      +---------------------+---------------------+
      | 9223372036854775807 | 9999999999999999999 |
      +---------------------+---------------------+
      

      The c1 value looks wrong.

      Note, implicit cast on INSERT works fine:

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a BIGINT UNSIGNED);
      INSERT INTO t1 VALUES (9999999999999999999e0);
      SELECT * FROM t1
      

      +----------------------+
      | a                    |
      +----------------------+
      | 10000000000000000000 |
      +----------------------+
      

      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.