Bug#16630: The update fields of the INSERT .. SELECT .. ON DUPLICATE KEY
UPDATE contains wrong data if the SELECT employs a temporary table. If the UPDATE values of the INSERT .. SELECT .. ON DUPLICATE KEY UPDATE statement contains fields from the SELECT part and the select employs a temporary table then those fields will contain wrong values because they aren't corrected to get data from the temporary table. The solution is to add these fields to the selects all_fields list, to store pointers to those fields in the selects ref_pointer_array and to access them via Item_ref objects. The substitution for Item_ref objects is done in the new function called Item_field::update_value_transformer(). It is called through the item->transform() mechanism at the end of the select_insert::prepare() function. sql/item.cc: Bug#16630: The update fields of the INSERT .. SELECT .. ON DUPLICATE KEY UPDATE contains wrong data if the SELECT employs a temporary table. The new method Item_field::update_value_transformer() is added. It substitutes fields in the update values list for references (Item_ref objects) to them. sql/item.h: Bug#16630: The update fields of the INSERT .. SELECT .. ON DUPLICATE KEY UPDATE contains wrong data if the SELECT employs a temporary table. The update_value_transformer() method is added to the Item and to the Item_field classes. sql/sql_insert.cc: Bug#16630: The update fields of the INSERT .. SELECT .. ON DUPLICATE KEY UPDATE contains wrong data if the SELECT employs a temporary table. Traverse update values and substitute fields from the select for references (Item_ref objects) to them. sql/sql_select.cc: Bug#16630: The update fields of the INSERT .. SELECT .. ON DUPLICATE KEY UPDATE contains wrong data if the SELECT employs a temporary table. Traverse update values and substitute fields from the select for references (Item_ref objects) to them. mysql-test/r/insert_select.result: Added a test case for bug#16630: The update fields of the INSERT .. SELECT .. ON DUPLICATE KEY UPDATE contains wrong data if the SELECT employs a temporary table. mysql-test/t/insert_select.test: Added a test case for bug#16630: The update fields of the INSERT .. SELECT .. ON DUPLICATE KEY UPDATE contains wrong data if the SELECT employs a temporary table.
Showing
Please register or sign in to comment