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

Wrong metadata for integer additive and multiplicative operators

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.1, 10.2, 10.3
    • Fix Version/s: 10.3.1
    • Component/s: OTHER
    • Labels:

      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 
      

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: