• Georgi Kodinov's avatar
    Bug #44399 : crash with statement using TEXT columns, aggregates, GROUP BY, and · 73481404
    Georgi Kodinov authored
    HAVING
                
    When calculating GROUP BY the server caches some expressions. It does
    that by allocating a string slot (Item_copy_string) and assigning the 
    value of the expression to it. This effectively means that the result
    type of the expression can be changed from whatever it was to a string.
    As this substitution takes place after the compile-time result type 
    calculation for IN but before the run-time type calculations, 
    it causes the type calculations in the IN function done at run time 
    to get unexpected results different from what was prepared at compile time.
                      
    In the CASE ... WHEN ... THEN ... statement there was a similar problem
    and it was solved by artificially adding a STRING argument to the set of 
    types of the IN/CASE arguments at compile time, so if any of the 
    arguments of the CASE function changes its type to a string it will 
    still be covered by the information prepared at compile time.
    
    mysql-test/include/mix1.inc:
      Bug #44399: extended the test to cover the different types
    mysql-test/r/func_in.result:
      Bug #44399: test case
    mysql-test/r/innodb_mysql.result:
      Bug #44399: extended the test to cover the different types
    mysql-test/t/func_in.test:
      Bug #44399: test case
    sql/item.cc:
      Bug #44399: Implement typed caching for GROUP BY
    sql/item.h:
      Bug #44399: Implement typed caching for GROUP BY
    sql/item_cmpfunc.cc:
      Bug #44399: remove the special case
    sql/sql_select.cc:
      Bug #44399: Implement typed caching for GROUP BY
    73481404
item.h 99.9 KB