diff --git a/executor/executor_test.go b/executor/executor_test.go index 3048a5136a203..4c8609e42ecc6 100644 --- a/executor/executor_test.go +++ b/executor/executor_test.go @@ -5991,6 +5991,32 @@ func (s *testSplitTable) TestKillTableReader(c *C) { wg.Wait() } +func (s *testSerialSuite1) TestPrevStmtDesensitization(c *C) { + tk := testkit.NewTestKit(c, s.store) + tk.MustExec("use test;") + oriCfg := config.GetGlobalConfig() + defer config.StoreGlobalConfig(oriCfg) + newCfg := *oriCfg + newCfg.EnableRedactLog = 1 + config.StoreGlobalConfig(&newCfg) + tk.MustExec("drop table if exists t") + tk.MustExec("create table t (a int)") + tk.MustExec("begin") + tk.MustExec("insert into t values (1),(2)") + c.Assert(tk.Se.GetSessionVars().PrevStmt.String(), Equals, "insert into t values ( ? ) , ( ? )") +} + +func (s *testSuite) TestIssue19372(c *C) { + tk := testkit.NewTestKit(c, s.store) + tk.MustExec("use test;") + tk.MustExec("drop table if exists t1, t2;") + tk.MustExec("create table t1 (c_int int, c_str varchar(40), key(c_str));") + tk.MustExec("create table t2 like t1;") + tk.MustExec("insert into t1 values (1, 'a'), (2, 'b'), (3, 'c');") + tk.MustExec("insert into t2 select * from t1;") + tk.MustQuery("select (select t2.c_str from t2 where t2.c_str <= t1.c_str and t2.c_int in (1, 2) order by t2.c_str limit 1) x from t1 order by c_int;").Check(testkit.Rows("a", "a", "a")) +} + func (s *testSuite) TestCollectDMLRuntimeStats(c *C) { tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test")