• Oleg Smirnov's avatar
    MDEV-31743 Server crash in store_length, assertion failure in... · 8e8c020f
    Oleg Smirnov authored
    MDEV-31743 Server crash in store_length, assertion failure in Type_handler_string_result::sort_length
    
    After MDEV-21580 the truncation of SORT_FIELD::length
      set_if_smaller(sortorder->length, thd->variables.max_sort_length)
    
    became conditional:
      if (is_variable_sized())
        set_if_smaller(length, thd->variables.max_sort_length)
    
    To provide correct functioning of is_variable_sized() SORT_FIELD::type
    must be set properly. This commit adds the necessary initialization
    of SORT_FIELD::type to JOIN_TAB::remove_duplicates() as it is done
    in filesort's sortlength() function.
    
    DBUG_ASSERT is added to sortlength() just in case to prevent
    a possible uint32 overflow
    8e8c020f
sql_select.cc 989 KB