Commit 6b07f729 authored by Sergey Petrunya's avatar Sergey Petrunya

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)
parent da98dfff
......@@ -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
......
......@@ -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))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment