Bug #111290 | No matching rows when joining multiple tables on binary/varbinary key | ||
---|---|---|---|
Submitted: | 6 Jun 2023 7:48 | Modified: | 8 Aug 2023 22:10 |
Reporter: | Tomasz Szlagowski | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S3 (Non-critical) |
Version: | 8.0.23, 8.0.33, 5.7 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[6 Jun 2023 7:48]
Tomasz Szlagowski
[6 Jun 2023 9:09]
MySQL Verification Team
Hello Tomasz, Thank you for the report and test case. regards, Umesh
[7 Jun 2023 12:24]
huahua xu
Hi Tomasz, It is incorrect that the method `Item_hex_string::clone_item` clone '0x93222796caba43ca979f5c96eb6898b7' to '0x8b3f9333488f5170' during the optimizer propagates constant values in the conditions. Item_hex_string::make_hex_str(const char * str, unsigned __int64 str_length) Item_hex_string::hex_string_init(const char * str, unsigned int str_length) Item_hex_string::Item_hex_string(const char * str, unsigned int str_length) Item_hex_string::clone_item() change_cond_ref_to_const(THD * thd, I_List<COND_CMP> * save_list, Item * and_father, Item * cond, Item * field, Item * value) change_cond_ref_to_const(THD * thd, I_List<COND_CMP> * save_list, Item * and_father, Item * cond, Item * field, Item * value) propagate_cond_constants(THD * thd, I_List<COND_CMP> * save_list, Item * and_father, Item * cond) propagate_cond_constants(THD * thd, I_List<COND_CMP> * save_list, Item * and_father, Item * cond) optimize_cond(THD * thd, Item * * cond, COND_EQUAL * * cond_equal, mem_root_deque<TABLE_LIST *> * join_list, Item::cond_result * cond_value) JOIN::optimize() Query_block::optimize(THD * thd) Query_expression::optimize(THD * thd, TABLE * materialize_destination, bool create_iterators) Sql_cmd_dml::execute_inner(THD * thd) Sql_cmd_dml::execute(THD * thd) mysql_execute_command(THD * thd, bool first_level) ...
[7 Jun 2023 12:28]
huahua xu
Additionally, you could see the detailed source code about the method `Item_hex_string::make_hex_str`
[7 Jun 2023 14:24]
huahua xu
The patch would fix the bug issue.
Attachment: Item_hex_string_clone_item_function_with_error_data.patch (application/octet-stream, text), 3.13 KiB.
[8 Aug 2023 22:10]
Jon Stephens
Documented fix as follows in the MySQL 8.2.0 changelog: A join on a BINARY column with a VARBINARY column of the same size, having matching values equal in size to that of the BINARY column in both columns, did not produce any matching rows. Closed.
[3 Nov 2023 20:58]
Jean-François Gagné
This bug, reported in 8.0 and 5.7, is marked as fixed in 8.2: will this be fixed in 8.0 ? And in 5.7 ?