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

Rounding functions return wrong data types for DATE input

    XMLWordPrintable

Details

    Description

      CREATE OR REPLACE TABLE t1 (a date);
      CREATE OR REPLACE TABLE t2 AS SELECT FLOOR(a), CEIL(a),ROUND(a),TRUNCATE(a,0) FROM t1;
      

      +---------------+--------------+------+-----+---------+-------+
      | Field         | Type         | Null | Key | Default | Extra |
      +---------------+--------------+------+-----+---------+-------+
      | FLOOR(a)      | bigint(12)   | YES  |     | NULL    |       |
      | CEIL(a)       | bigint(12)   | YES  |     | NULL    |       |
      | ROUND(a)      | double(17,0) | YES  |     | NULL    |       |
      | TRUNCATE(a,0) | double(17,0) | YES  |     | NULL    |       |
      +---------------+--------------+------+-----+---------+-------+
      

      A date value has 8 digits in numeric format: YYYYMMDD.

      • INT(9) should be enough for ROUND() with a negative argument (to be checked in a separate MDEV)
      • INT(8) should be enough for ROUND() with a non-negative argument
      • INT(8) should be enough for all other functions

      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.