diff --git a/errors.toml b/errors.toml index 0dcbf9d6c550d..d170522ec4e6a 100644 --- a/errors.toml +++ b/errors.toml @@ -371,6 +371,11 @@ error = ''' Deadlock found when trying to get lock; try restarting transaction ''' +["executor:1295"] +error = ''' +This command is not supported in the prepared statement protocol yet +''' + ["executor:1317"] error = ''' Query execution was interrupted diff --git a/executor/errors.go b/executor/errors.go index df9dbed68e2e4..31967c8a319e8 100644 --- a/executor/errors.go +++ b/executor/errors.go @@ -27,6 +27,7 @@ var ( ErrResultIsEmpty = terror.ClassExecutor.New(mysql.ErrResultIsEmpty, mysql.MySQLErrName[mysql.ErrResultIsEmpty]) ErrBuildExecutor = terror.ClassExecutor.New(mysql.ErrBuildExecutor, mysql.MySQLErrName[mysql.ErrBuildExecutor]) ErrBatchInsertFail = terror.ClassExecutor.New(mysql.ErrBatchInsertFail, mysql.MySQLErrName[mysql.ErrBatchInsertFail]) + ErrUnsupportedPs = terror.ClassExecutor.New(mysql.ErrUnsupportedPs, mysql.MySQLErrName[mysql.ErrUnsupportedPs]) ErrCantCreateUserWithGrant = terror.ClassExecutor.New(mysql.ErrCantCreateUserWithGrant, mysql.MySQLErrName[mysql.ErrCantCreateUserWithGrant]) ErrPasswordNoMatch = terror.ClassExecutor.New(mysql.ErrPasswordNoMatch, mysql.MySQLErrName[mysql.ErrPasswordNoMatch]) diff --git a/executor/executor_test.go b/executor/executor_test.go index aa3427c739c36..eeafe0e9805ce 100644 --- a/executor/executor_test.go +++ b/executor/executor_test.go @@ -5620,6 +5620,11 @@ func (s *testClusterTableSuite) TearDownSuite(c *C) { s.testSuiteWithCliBase.TearDownSuite(c) } +func (s *testSuiteP1) TestPrepareLoadData(c *C) { + tk := testkit.NewTestKit(c, s.store) + tk.MustGetErrCode(`prepare stmt from "load data local infile '/tmp/load_data_test.csv' into table test";`, mysql.ErrUnsupportedPs) +} + func (s *testClusterTableSuite) TestSlowQuery(c *C) { writeFile := func(file string, data string) { f, err := os.OpenFile(file, os.O_CREATE|os.O_WRONLY, 0644) diff --git a/executor/prepared.go b/executor/prepared.go index aae6f4bd0a58d..4bde0554d7384 100644 --- a/executor/prepared.go +++ b/executor/prepared.go @@ -147,6 +147,10 @@ func (e *PrepareExec) Next(ctx context.Context, req *chunk.Chunk) error { return ErrPrepareDDL } + if _, ok := stmt.(*ast.LoadDataStmt); ok { + return ErrUnsupportedPs + } + // Prepare parameters should NOT over 2 bytes(MaxUint16) // https://dev.mysql.com/doc/internals/en/com-stmt-prepare-response.html#packet-COM_STMT_PREPARE_OK. if len(extractor.markers) > math.MaxUint16 {