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

Wrong metadata for DATE_ADD('string', INVERVAL)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 10.0.4
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      CREATE TABLE t1 AS SELECT DATE_ADD('2011-01-02 12:13:14', INTERVAL 1 MINUTE) AS a;
      SHOW COLUMNS FROM t1;

      correctly reports a VARCHAR column:

      +-------+-------------+------+-----+---------+-------+
      | Field | Type        | Null | Key | Default | Extra |
      +-------+-------------+------+-----+---------+-------+
      | a     | varchar(26) | YES  |     | NULL    |       |
      +-------+-------------+------+-----+---------+-------+

      But "mysql --column-type-info" reports a wrong result:

      $ mysql --column-type-info
       
      MariaDB [(none)]> SELECT DATE_ADD('2011-01-02 12:13:14', INTERVAL 1 MINUTE);
      Field   1:  `DATE_ADD('2011-01-02 12:13:14', INTERVAL 1 MINUTE)`
      Type:       STRING
      Collation:  binary (63)
      Length:     26
      Max_length: 19
      Decimals:   31
      Flags:      BINARY 
      +----------------------------------------------------+
      | DATE_ADD('2011-01-02 12:13:14', INTERVAL 1 MINUTE) |
      +----------------------------------------------------+
      | 2011-01-02 12:14:14                                |
      +----------------------------------------------------+

      Notice, collation binary(63), which implies a VARBINARY column type,
      and which is wrong.

      MySQL-5.6 in the same scenario returns "Collation: utf8_general_ci (33)",
      which looks correct and corresponds to the connection character set ut8.

        Attachments

          Activity

            People

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