[SHOW] EXPLAIN UPDATE/DELETE

- Post-merge fixes (conflict with DELETE .. RETURNING)
- Add a testcase with EXPLAIN ... DELETE ... RETURNING
This commit is contained in:
Sergey Petrunya 2013-08-26 14:43:52 +04:00
parent d2d9eb65e4
commit eeb6713257
2 changed files with 18 additions and 7 deletions

View File

@ -84,3 +84,14 @@ explain update t0, t1 set t1.a=t1.a+1 where t0.a = t1.a;
drop table t0, t1;
--echo #
--echo # Try DELETE ... RETURNING ...
--echo #
create table t0 (a int);
insert into t0 values (1),(2),(3),(4);
explain delete from t0 where a=1 returning a;
explain delete from t0 returning a;
drop table t0;

View File

@ -658,18 +658,18 @@ cleanup:
exit_without_my_ok:
query_plan.save_query_plan_footprint(thd->lex->query_plan_footprint);
select_send *result;
if (!(result= new select_send()))
select_send *result2;
if (!(result2= new select_send()))
return 1; /* purecov: inspected */
List<Item> dummy; /* note: looked in 5.6 and they too use a dummy list like this */
result->prepare(dummy, &thd->lex->unit);
thd->send_explain_fields(result);
int err2= thd->lex->query_plan_footprint->print_explain(result, 0 /* explain flags*/);
result2->prepare(dummy, &thd->lex->unit);
thd->send_explain_fields(result2);
int err2= thd->lex->query_plan_footprint->print_explain(result2, 0 /* explain flags*/);
if (err2)
result->abort_result_set();
result2->abort_result_set();
else
result->send_eof();
result2->send_eof();
delete select;
free_underlaid_joins(thd, select_lex);