Commit 526a4e00 authored by unknown's avatar unknown

Fixed explain error handling


mysql-test/r/subselect.result:
  test of subselect explain
mysql-test/t/subselect.test:
  test of subselect explain
parent 0d317198
......@@ -279,6 +279,8 @@ UNIQUE KEY `numreponse` (`numreponse`),
KEY `pseudo` (`pseudo`,`numeropost`)
) TYPE=MyISAM;
INSERT INTO threadhardwarefr7 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
EXPLAIN SELECT numreponse FROM threadhardwarefr7 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM threadhardwarefr7 WHERE numeropost='1');
Subselect returns more than 1 record
EXPLAIN SELECT MAX(numreponse) FROM threadhardwarefr7 WHERE numeropost='1';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE Select tables optimized away
......
......@@ -177,7 +177,8 @@ CREATE TABLE `threadhardwarefr7` (
KEY `pseudo` (`pseudo`,`numeropost`)
) TYPE=MyISAM;
INSERT INTO threadhardwarefr7 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
-- error 1240
EXPLAIN SELECT numreponse FROM threadhardwarefr7 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM threadhardwarefr7 WHERE numeropost='1');
EXPLAIN SELECT MAX(numreponse) FROM threadhardwarefr7 WHERE numeropost='1';
EXPLAIN SELECT numreponse FROM threadhardwarefr7 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM threadhardwarefr7 WHERE numeropost='1');
drop table if exists threadhardwarefrtest7;
......@@ -371,13 +371,17 @@ JOIN::optimize()
}
#endif
conds=optimize_cond(conds,&cond_value);
if (thd->fatal_error || thd->net.report_error)
conds= optimize_cond(conds,&cond_value);
if (thd->fatal_error)
{
// quick abort
delete procedure;
error = 0;
error= 0;
DBUG_RETURN(1);
}
} else if (thd->net.report_error)
// normal error processing & cleanup
DBUG_RETURN(-1);
if (cond_value == Item::COND_FALSE || !unit->select_limit_cnt)
{ /* Impossible cond */
zero_result_cause= "Impossible WHERE";
......@@ -7516,8 +7520,8 @@ int mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
break;
}
if (res > 0)
res= -res; // mysql_explain_select do not report error
if (res > 0 || thd->net.report_error)
res= -1; // mysql_explain_select do not report error
DBUG_RETURN(res);
}
......
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