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

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

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 10.0.3, 10.1
    • 10.1.8
    • OTHER
    • 10.1.8-4

    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.

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              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.