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

Wrong metadata or column type for LEAST(1.0,'10')

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 10.0.3
    • Fix Version/s: 10.0
    • Component/s: None
    • Labels:

      Description

      There is a difference in column type metadata and actual column type
      created for LEAST(1.0,'10'):

      $ mysql --column-type-info test
      MariaDB [test]> select least(1.0,'10');
      Field   1:  `least(1.0,'10')`
      Catalog:    `def`
      Database:   ``
      Table:      ``
      Org_table:  ``
      Type:       VAR_STRING
      Collation:  binary (63)
      Length:     23
      Max_length: 1
      Decimals:   31
      Flags:      NOT_NULL BINARY 
      +-----------------+
      | least(1.0,'10') |
      +-----------------+
      | 1               |
      +-----------------+
      1 row in set (0.00 sec)
      

      Notice, the reported column type is VAR_STRING.

      However,

      $ mysql  test
      MariaDB [test]> drop table if exists t1; create table t1 as select least(1.0,'10') as a; show create table t1;
      
      +-------+----------------------------------------------------------------------------------------------+
      | Table | Create Table                                                                                 |
      +-------+----------------------------------------------------------------------------------------------+
      | t1    | CREATE TABLE `t1` (
        `a` double NOT NULL DEFAULT '0'
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
      +-------+----------------------------------------------------------------------------------------------+
      1 row in set (0.00 sec)
      

      Notice, column type is DOUBLE.

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            bar Alexander Barkov added a comment -

            MySQL-5.6 exhibits similar behaviour.

            Show
            bar Alexander Barkov added a comment - MySQL-5.6 exhibits similar behaviour.

              People

              • Assignee:
                bar Alexander Barkov
                Reporter:
                bar Alexander Barkov
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: