Comment 3 for bug 1006231

Revision history for this message
Timour Katchaounov (timour) wrote :

Correction to the previous comment. The bug is not a duplicate for lp:1001117.

Analysis:
When a subquery that needs a temp table is executed during the prepare or optimize
phase of the outer query, at the end of the subquery execution all the JOIN_TABs of
the subquery are replaced by a new JOIN_TAB that selects from the temp table.
However that temp table has no corresponding TABLE_LIST. Once EXPLAIN execution
reaches its last phase, it tries to print the names of the subquery tables through
its TABLE_LISTs, but in the case of this bug there is no such TABLE_LIST (it is NULL),
hence a crash.

This bug is not present in the 5.5 branch for lp:944706, task MDEV-193
because this patch takes care of the situation that causes the crash.

The fix in 5.3 is to block subquery evaluation inside Item_func_like::fix_fields
using the Item::is_expensive() test. When the fix is merged into 5.5 it will
interoperate correctly with the fix for lp:944706.