From cf0a70902eb230988c00da60f2b9a5789fa99e88 Mon Sep 17 00:00:00 2001 From: qw4990 Date: Wed, 4 Jan 2023 10:49:50 +0800 Subject: [PATCH] fixup --- planner/core/plan_cache_test.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/planner/core/plan_cache_test.go b/planner/core/plan_cache_test.go index 8471340a5ac11..0aa5c4e02d7cb 100644 --- a/planner/core/plan_cache_test.go +++ b/planner/core/plan_cache_test.go @@ -394,11 +394,21 @@ func TestIssue40225(t *testing.T) { tk.MustExec("set @a='1'") tk.MustExec("execute st using @a") tk.MustQuery("show warnings").Sort().Check(testkit.Rows("Warning 1105 skip plan-cache: '1' may be converted to INT")) // plan-cache limitation - tk.MustExec("create binding for select * from t where a<1 using select /*+ ignore_plan_cache() */ * from t where a<1") tk.MustExec("execute st using @a") tk.MustQuery("show warnings").Sort().Check(testkit.Rows("Warning 1105 skip plan-cache: ignore plan cache by binding")) // no warning about plan-cache limitations('1' -> INT) since plan-cache is totally disabled. + + tk.MustExec("prepare st from 'select * from t where a>?'") + tk.MustExec("set @a=1") + tk.MustExec("execute st using @a") + tk.MustExec("execute st using @a") + tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("1")) + tk.MustExec("create binding for select * from t where a>1 using select /*+ ignore_plan_cache() */ * from t where a>1") + tk.MustExec("execute st using @a") + tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("0")) + tk.MustExec("execute st using @a") + tk.MustQuery("select @@last_plan_from_binding").Check(testkit.Rows("1")) } func TestUncacheableReason(t *testing.T) {