From 86897e0c47eabf2c5026bf3ea620bed7678f179f Mon Sep 17 00:00:00 2001 From: tiancaiamao Date: Tue, 30 Jan 2018 02:47:00 -0600 Subject: [PATCH] ast: do statement is read only (#5752) --- ast/read_only_checker.go | 2 +- ast/read_only_checker_test.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ast/read_only_checker.go b/ast/read_only_checker.go index aa0e49f02fccb..99c48f5800fad 100644 --- a/ast/read_only_checker.go +++ b/ast/read_only_checker.go @@ -27,7 +27,7 @@ func IsReadOnly(node Node) bool { node.Accept(&checker) return checker.readOnly - case *ExplainStmt: + case *ExplainStmt, *DoStmt: return true default: return false diff --git a/ast/read_only_checker_test.go b/ast/read_only_checker_test.go index 0b56b4d85d388..7abd27f066fe5 100644 --- a/ast/read_only_checker_test.go +++ b/ast/read_only_checker_test.go @@ -38,4 +38,7 @@ func (s *testCacheableSuite) TestCacheable(c *C) { stmt = &ExplainStmt{} c.Assert(IsReadOnly(stmt), IsTrue) + + stmt = &DoStmt{} + c.Assert(IsReadOnly(stmt), IsTrue) }