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

Wrong metadata for DATE_ADD('string', INVERVAL)

    Details

    • Type: Bug
    • Status: Closed
    • 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.

        Gliffy Diagrams

          Activity

          Hide
          bar Alexander Barkov added a comment -

          The problem seems to be fixed by some earlier change
          and is not reproducible any longer.
          Only adding a test case into func_time.test.

          Show
          bar Alexander Barkov added a comment - The problem seems to be fixed by some earlier change and is not reproducible any longer. Only adding a test case into func_time.test.

            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: