Fix union.test failure in buildbot: alternate fix for BUG#49734

mysql-test/r/union.result:
  Update test results (checked, it should be "DEPENDENT SUBQUERY" as it will actually run subquery's join multiple times. There is no reason to do that but executor will still do it)
This commit is contained in:
Sergey Petrunya 2010-03-20 19:59:30 +03:00
parent e58b56a2b6
commit 05433dc58c
2 changed files with 21 additions and 1 deletions

View File

@ -1632,7 +1632,7 @@ ORDER BY (SELECT a FROM t2 WHERE b = 12);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
2 UNION t1 ALL NULL NULL NULL NULL 2 100.00
3 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2

View File

@ -18319,6 +18319,26 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
unit;
unit= unit->next_unit())
{
/*
This fix_fields() call is to handle an edge case like this:
SELECT ... UNION SELECT ... ORDER BY (SELECT ...)
for such queries, we'll get here before having called
subquery_expr->fix_fields(), which will cause failure to
*/
if (unit->item && !unit->item->fixed)
{
Item *ref= unit->item;
if (unit->item->fix_fields(thd, &ref))
DBUG_VOID_RETURN;
DBUG_ASSERT(ref == unit->item);
}
/*
Display subqueries only if they are not parts of eliminated WHERE/ON
clauses.
*/
if (!(unit->item && unit->item->eliminated))
{
if (mysql_explain_union(thd, unit, result))