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

Length of CURRENT_TIME is too long.

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 5.3.12, 5.5.36, 10.0.10
    • 5.5
    • None
    • None

    Description

      CURRENT_TIME is limited to positive time in the range
      from 00:00:00 to 23:59:59. So it should be enough 8 characters
      to store it. However, it uses 10 characters in MariaDB-10.0.

      For this script:

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 AS SELECT CONCAT(CURRENT_TIME());
      SHOW COLUMNS FROM t1;

      MariaDB 5.1 and 5.3 correctly returned length 8
      (but wrong data type varbinary).

      +------------------------+--------------+------+-----+---------+-------+
      | Field                  | Type         | Null | Key | Default | Extra |
      +------------------------+--------------+------+-----+---------+-------+
      | CONCAT(CURRENT_TIME()) | varbinary(8) | NO   |     |         |       |
      +------------------------+--------------+------+-----+---------+-------+

      MariaDB 5.5 and 10.0 return wrong length (but correct data type varchar):

      +------------------------+-------------+------+-----+---------+-------+
      | Field                  | Type        | Null | Key | Default | Extra |
      +------------------------+-------------+------+-----+---------+-------+
      | CONCAT(CURRENT_TIME()) | varchar(10) | NO   |     |         |       |
      +------------------------+-------------+------+-----+---------+-------+

      MySQL 5.5 and 5.6 return both type and length correctly:

      MySQL-5.5 and MySQL-5.6
      +------------------------+------------+------+-----+---------+-------+
      | Field                  | Type       | Null | Key | Default | Extra |
      +------------------------+------------+------+-----+---------+-------+
      | CONCAT(CURRENT_TIME()) | varchar(8) | NO   |     |         |       |
      +------------------------+------------+------+-----+---------+-------+

      Attachments

        Activity

          People

            bar Alexander Barkov
            bar Alexander Barkov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.