-
Igor Babaev authored
When merging a view / derived table the function SELECT_LEX::merge_subquery incorrectly updated the list SELECT_LEX::leaf_tables. Erroneously it appended the leaf_tables list of the merged object L and then removed the reference to the merged object T from the SELECT_LEX::leaf_tables list. A correct implementation should insert the list L into the SELECT_LEX::leaf_tables list in place of the element of the list that refers to T. The bug could lead to wrong results or even crashes for queries with nested outer joins over views / derived tables.
be03fe9c