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

Rounding functions create a wrong data type for integer input

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.1, 10.2, 10.3, 10.4, 10.5
    • 10.4.14, 10.5.5
    • Data types
    • 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

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