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

Rounding functions create a wrong data type for integer input

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.1, 10.2, 10.3, 10.4, 10.5
    • Fix Version/s: 10.4.14, 10.5.5
    • Component/s: Data types
    • Labels:
      None

      Description

      CREATE OR REPLACE TABLE t1 (a BIGINT);
      CREATE OR REPLACE TABLE t2 AS SELECT
        a, ROUND(a), TRUNCATE(a,0), FLOOR(a), CEILING(a) FROM t1;
      DESC t2;
      

      +---------------+---------------+------+-----+---------+-------+
      | Field         | Type          | Null | Key | Default | Extra |
      +---------------+---------------+------+-----+---------+-------+
      | a             | bigint(20)    | YES  |     | NULL    |       |
      | ROUND(a)      | bigint(19)    | YES  |     | NULL    |       |
      | TRUNCATE(a,0) | bigint(19)    | YES  |     | NULL    |       |
      | FLOOR(a)      | decimal(19,0) | YES  |     | NULL    |       |
      | CEILING(a)    | decimal(19,0) | YES  |     | NULL    |       |
      +---------------+---------------+------+-----+---------+-------+
      

      The data types for all columns with functions are not equal to the original data type. Looks wrong. All data types are expected to be bigint(20).

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: