[MDEV-4848] Wrong metadata or column type for LEAST(1.0,'10') Created: 2013-08-07  Updated: 2015-10-22  Resolved: 2015-10-01

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 10.0.3, 10.1
Fix Version/s: 10.1.8

Type: Bug Priority: Minor
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: upstream

Issue Links:
Relates
relates to MDEV-8984 LEAST datatype error Open
Sprint: 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.



 Comments   
Comment by Alexander Barkov [ 2013-08-07 ]

MySQL-5.6 exhibits similar behaviour.

Generated at Thu Feb 08 06:59:39 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.