Skip to content

Commit

Permalink
WhyThisWorks
Browse files Browse the repository at this point in the history
  • Loading branch information
fzzf678 committed Jan 9, 2023
1 parent d269e8c commit d556fc8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 29 deletions.
14 changes: 7 additions & 7 deletions executor/seqtest/prepared_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,13 @@ func TestPreparedLimitOffset(t *testing.T) {
r := tk.MustQuery(`execute stmt_test_1 using @a, @b;`)
r.Check(testkit.Rows("2"))

//tk.MustExec(`set @a=1.1`)
//_, err := tk.Exec(`execute stmt_test_1 using @a, @b;`)
//require.True(t, plannercore.ErrWrongArguments.Equal(err))
//
//tk.MustExec(`set @c="-1"`)
//_, err = tk.Exec("execute stmt_test_1 using @c, @c")
//require.True(t, plannercore.ErrWrongArguments.Equal(err))
tk.MustExec(`set @a=1.1`)
_, err := tk.Exec(`execute stmt_test_1 using @a, @b;`)
require.True(t, plannercore.ErrWrongArguments.Equal(err))

tk.MustExec(`set @c="-1"`)
_, err = tk.Exec("execute stmt_test_1 using @c, @c")
require.True(t, plannercore.ErrWrongArguments.Equal(err))

stmtID, _, _, err := tk.Session().PrepareStmt("select id from prepare_test limit ?")
require.NoError(t, err)
Expand Down
22 changes: 0 additions & 22 deletions planner/core/plan_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,25 +458,3 @@ func TestUncacheableReason(t *testing.T) {
// show the corresponding un-cacheable reason at execute-stage as well
tk.MustQuery("show warnings").Check(testkit.Rows("Warning 1105 skip plan-cache: query has 'limit ?' is un-cacheable"))
}

//func TestLimitUnsupportedCase(t *testing.T) {
// store := testkit.CreateMockStore(t)
// tk := testkit.NewTestKit(t, store)
// tk.MustExec("use test")
// //tk.MustExec("drop table if exists t")
// //tk.MustExec("create table t(a int, key(a))")
// tk.MustExec("prepare st from 'select 1 limit ?'")

//tk.MustExec("set @a = 1.2")
//tk.MustGetErrMsg("execute stmt using @a", "[planner:1210]Incorrect arguments to LIMIT")
//tk.MustExec("set @a = 1.")
//tk.MustGetErrMsg("execute stmt using @a", "[planner:1210]Incorrect arguments to LIMIT")
//tk.MustExec("set @a = '0'")
//tk.MustGetErrMsg("execute stmt using @a", "[planner:1210]Incorrect arguments to LIMIT")
//tk.MustExec("set @a = '1'")
//tk.MustGetErrMsg("execute stmt using @a", "[planner:1210]Incorrect arguments to LIMIT")
//tk.MustExec("set @a = 1_2")
//tk.MustGetErrMsg("execute stmt using @a", "[planner:1210]Incorrect arguments to LIMIT")
//_, err := tk.Exec("execute stmt using @a")
//require.True(t, plannercore.ErrWrongArguments.Equal(err))
//}

0 comments on commit d556fc8

Please sign in to comment.