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

Rounding functions return a wrong data type for a BIT, ENUM, SET argument

    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 BIT(64));
      INSERT INTO t1 VALUES (0xFFFFFFFFFFFFFFFF);
      CREATE OR REPLACE TABLE t2 AS
        SELECT a, FLOOR(a), CEILING(a), TRUNCATE(a,0), ROUND(a) FROM t1;
      SHOW CREATE TABLE t2;
      

      +-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      | Table | Create Table                                                                                                                                                                                                                                                                    |
      +-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      | t2    | CREATE TABLE `t2` (
        `a` bit(64) DEFAULT NULL,
        `FLOOR(a)` decimal(64,0) DEFAULT NULL,
        `CEILING(a)` decimal(64,0) DEFAULT NULL,
        `TRUNCATE(a,0)` bigint(64) unsigned DEFAULT NULL,
        `ROUND(a)` decimal(64,0) unsigned DEFAULT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
      +-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      

      The data type for all columns with functions are wrong. The expected data type is BIGINT(20) UNSIGNED.

      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.