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

Wrong result for CAST(9999999999999999999.0)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 10.0, 10.1, 10.2
    • Fix Version/s: 10.4.5
    • Component/s: Data types
    • Labels:
      None
    • Sprint:
      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

              Assignee:
              bar Alexander Barkov
              Reporter:
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Git Integration