[MDEV-12869] Wrong metadata for integer additive and multiplicative operators Created: 2017-05-22  Updated: 2017-05-23  Resolved: 2017-05-23

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 10.1, 10.2, 10.3
Fix Version/s: 10.3.1

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: datatype


 Description   

I start mysql --column-type-info test and execute this script:

SELECT 1+1, 1*1;

It reports the following metadata:

Field   1:  `1+1`
Type:       LONGLONG
Length:     3
 
Field   2:  `1*1`
Type:       LONGLONG
Length:     3

However, if I do:

CREATE OR REPLACE TABLE t1 AS SELECT 1+1,1*1;
DESCRIBE t1;

It creates INT(3):

+-------+--------+------+-----+---------+-------+
| Field | Type   | Null | Key | Default | Extra |
+-------+--------+------+-----+---------+-------+
| 1+1   | int(3) | NO   |     | 0       |       |
| 1*1   | int(3) | NO   |     | 0       |       |
+-------+--------+------+-----+---------+-------+

Metadata should be fixed to match the real column type created on CREATE..SELECT.

The same problem is repeatable for all Item_func_numhybrid descendants:

      Item_func_numhybrid 
        Item_func_num1    
          Item_func_neg   
          Item_func_abs   
          Item_func_int_val
            Item_func_ceiling
            Item_func_floor  
        Item_num_op
          Item_func_additive_op
            Item_func_plus
            Item_func_minus
          Item_func_mul
          Item_func_div
          Item_func_mod
        Item_func_round
        Item_func_seconds_hybrid
          Item_func_unix_timestamp
          Item_func_time_to_sec 



 Comments   
Comment by Alexander Barkov [ 2017-05-23 ]

Pushed into bb-10.2-ext

Generated at Thu Feb 08 08:01:07 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.