diff --git a/executor/trace_test.go b/executor/trace_test.go index fe60b58692..15d7477653 100644 --- a/executor/trace_test.go +++ b/executor/trace_test.go @@ -39,6 +39,8 @@ func (s *testSuite1) TestTraceExec(c *C) { // | └─recordSet.Next | 22:08:38.249340 | 155.317µs | // +---------------------------+-----------------+------------+ rows = tk.MustQuery("trace format='row' select * from trace where id = 0;").Rows() + c.Assert(len(rows) > 1, IsTrue) + rows = tk.MustQuery("trace format='row' delete from trace where id = 0").Rows() c.Assert(len(rows) > 1, IsTrue) } diff --git a/planner/core/planbuilder.go b/planner/core/planbuilder.go index 29c981b1e6..6c02b574fa 100644 --- a/planner/core/planbuilder.go +++ b/planner/core/planbuilder.go @@ -1984,12 +1984,7 @@ func (b *PlanBuilder) buildDDL(node ast.DDLNode) (Plan, error) { // underlying query and then constructs a schema, which will be used to constructs // rows result. func (b *PlanBuilder) buildTrace(trace *ast.TraceStmt) (Plan, error) { - if _, ok := trace.Stmt.(*ast.SelectStmt); !ok && trace.Format == "row" { - return nil, errors.New("trace only supports select query when format is row") - } - p := &Trace{StmtNode: trace.Stmt, Format: trace.Format} - switch trace.Format { case "row": retFields := []string{"operation", "duration", "spanID"}