Fix LP BUG#715034
Analysis: The failed assert is a result of calling Item_sum_distinct::clear() on an incomplete object for which Item_sum_distinct::setup() was not yet called. The reason is that JOIN::exec for the outer query calls JOIN::reinit() for all its subqueries, which in turn calls clear() for all aggregate functions of the subqueries. The call stack is: mysql_explain_union -> mysql_select -> JOIN::exec -> select_desribe -> mysql_explain_union -> mysql_select -> JOIN::reinit This assert doesn't fail in the main 5.3 because constant subqueries are being executed during the optimize phase of the outer query, thus the Unique object is created before calling JOIN::exec for the outer query, and Item_sum_distinct::clear() actually cleans the Unique object. Solution: The best solution is the obvious one - substitute the assert with a test whether Item_sum_distinct::tree is NULL.
Showing
Please register or sign in to comment