• unknown's avatar
    Fixed bug #18206. · f8391c74
    unknown authored
    The bug report revealed two problems related to min/max optimization:
    1. If the length of a constant key used in a SARGable condition for
    for the MIN/MAX fields is greater than the length of the field an 
    unwanted warning on key truncation is issued;
    2. If MIN/MAX optimization is applied to a partial index, like INDEX(b(4))
    than can lead to returning a wrong result set.
    
    
    mysql-test/r/func_group.result:
      Added test cases for bug #18206.
    mysql-test/t/func_group.test:
      Added test cases for bug #18206.
    sql/opt_sum.cc:
      Fixed bug #18206.
      Suppressed the warning about data truncation when store_val_in_field
      was used to store keys for the field used in MIN/MAX optimization.
      Blocked MIN/MAX optimization for partial keys, such as in INDEX(b(4)).
    sql/sql_select.cc:
      Fixed bug #18206.
      Added a parameter for the function store_val_in_field allowing to
      control setting warnings about data truncation in the function.
    sql/sql_select.h:
      Fixed bug #18206.
      Added a parameter for the function store_val_in_field allowing to
      control setting warnings about data truncation in the function.
    f8391c74
func_group.test 18.5 KB