Commit eeb67132 authored by Sergey Petrunya's avatar Sergey Petrunya

[SHOW] EXPLAIN UPDATE/DELETE

- Post-merge fixes (conflict with DELETE .. RETURNING)
- Add a testcase with EXPLAIN ... DELETE ... RETURNING
parent d2d9eb65
......@@ -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;
......@@ -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);
......
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