{"push_id":1074681031,"size":1,"distinct_size":1,"ref":"refs/heads/5.5","head":"9a987142f93756b37b2ff02d513034cc4079c978","before":"6c0e231c0282b43d6a46a4983f5971e960d3b8ca","commits":[{"sha":"9a987142f93756b37b2ff02d513034cc4079c978","author":{"email":"62cdb7020ff920e5aa642c3d4066950dd1f01f4d@mariadb.org","name":"Alexander Barkov"},"message":"MDEV-9745 Crash with CASE WHEN TRUE THEN COALESCE(CAST(NULL AS UNSIGNED)) ELSE 4 END\n\nThis is a backport of the patch for MDEV-9653 (fixed earlier in 10.1.13).\n\nThe code in Item_func_case::fix_length_and_dec() did not\ncalculate max_length and decimals properly.\n\nIn case of any numeric result (DECIMAL, REAL, INT) a generic method\nItem_func_case::agg_num_lengths() was called, which could erroneously result\ninto a DECIMAL item with max_length==0 and decimals==0, so the constructor of\nField_new_decimals tried to create a field of DECIMAL(0,0) type,\nwhich caused a crash.\n\nUnlike Item_func_case, the code responsible for merging attributes in\nItem_func_coalesce::fix_length_and_dec() works fine: it has specific execution\nbranches for all distinct numeric types and correctly creates a DECIMAL(1,0)\ncolumn instead of DECIMAL(0,0) for the same set of arguments.\n\nThe fix does the following:\n- Moves the attribute merging code from Item_func_coalesce::fix_length_and_dec()\n  to a new method Item_func_hybrid_result_type::fix_attributes()\n- Removes the wrong code from Item_func_case::fix_length_and_dec()\n  and reuses fix_attributes() in both Item_func_coalesce::fix_length_and_dec()\n  and Item_func_case::fix_length_and_dec()\n- Fixes count_real_length() and count_decimal_length() to get an array\n  of Items as an argument, instead of using Item::args directly.\n  This is needed for Item_func_case::fix_length_and_dec().\n- Moves methods Item_func::count_xxx_length() from \"public\" to \"protected\".\n- Removes Item_func_case::agg_num_length(), as it's not used any more.\n- Additionally removes Item_func_case::agg_str_length(),\n  as it also was not used (dead code).","distinct":true,"url":"https://api.github.com/repos/MariaDB/server/commits/9a987142f93756b37b2ff02d513034cc4079c978"}]}