From 6020c562943dc7212ec2f16a601b0d8fe72fc480 Mon Sep 17 00:00:00 2001 From: qw4990 Date: Fri, 17 May 2024 16:44:34 +0800 Subject: [PATCH] fixup --- pkg/executor/select_into_test.go | 12 ++++++++++++ pkg/planner/core/point_get_plan.go | 3 +++ 2 files changed, 15 insertions(+) diff --git a/pkg/executor/select_into_test.go b/pkg/executor/select_into_test.go index 0737683fe1b44..0587c13d9711f 100644 --- a/pkg/executor/select_into_test.go +++ b/pkg/executor/select_into_test.go @@ -55,6 +55,18 @@ func TestSelectIntoFileExists(t *testing.T) { require.True(t, strings.Contains(err.Error(), outfile)) } +func TestSelectIntoOutfilePointGet(t *testing.T) { + outfile := randomSelectFilePath("TestSelectIntoOutfilePointGet") + store := testkit.CreateMockStore(t) + tk := testkit.NewTestKit(t, store) + tk.MustExec("use test") + + tk.MustExec(`create table t (id int not null, primary key (id) /*T![clustered_index] CLUSTERED */ );`) + tk.MustExec(`insert into t values(1);`) + tk.MustExec(fmt.Sprintf("select * from t where id = 1 into outfile %q", outfile)) + cmpAndRm("1\n", outfile, t) +} + func TestSelectIntoOutfileTypes(t *testing.T) { outfile := randomSelectFilePath("TestSelectIntoOutfileTypes") store := testkit.CreateMockStore(t) diff --git a/pkg/planner/core/point_get_plan.go b/pkg/planner/core/point_get_plan.go index 0a378b3fd559e..f7cff29350596 100644 --- a/pkg/planner/core/point_get_plan.go +++ b/pkg/planner/core/point_get_plan.go @@ -874,6 +874,9 @@ func TryFastPlan(ctx PlanContext, node ast.Node) (p Plan) { ctx.GetSessionVars().PlanColumnID.Store(0) switch x := node.(type) { case *ast.SelectStmt: + if x.SelectIntoOpt != nil { + return nil + } defer func() { vars := ctx.GetSessionVars() if vars.SelectLimit != math2.MaxUint64 && p != nil {