Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysql, errno: Unify the mysql error codes and related error messages. #58790

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions br/pkg/utils/retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/google/uuid"
"github.com/pingcap/errors"
"github.com/pingcap/log"
tmysql "github.com/pingcap/tidb/pkg/errno"
"github.com/pingcap/tidb/pkg/errno"
"github.com/pingcap/tidb/pkg/parser/terror"
"github.com/pingcap/tidb/pkg/util/logutil"
"github.com/tikv/client-go/v2/tikv"
Expand Down Expand Up @@ -104,7 +104,7 @@ func WithRetryReturnLastErr(
func FallBack2CreateTable(err error) bool {
switch nerr := errors.Cause(err).(type) {
case *terror.Error:
return nerr.Code() == tmysql.ErrInvalidDDLJob
return nerr.Code() == errno.ErrInvalidDDLJob
}
return false
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/ddl/column_modify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ func TestChangeColumn(t *testing.T) {
err = tk.ExecToErr("alter table t4 change c1 a1 int not null;")
require.EqualError(t, err, "[ddl:1265]Data truncated for column 'a1' at row 1")
sql = "alter table t4 change c2 a bigint not null;"
tk.MustGetErrCode(sql, mysql.WarnDataTruncated)
tk.MustGetErrCode(sql, errno.WarnDataTruncated)
sql = "alter table t3 modify en enum('a', 'z', 'b', 'c') not null default 'a'"
tk.MustExec(sql)
// Rename to an existing column.
Expand All @@ -365,12 +365,12 @@ func TestChangeColumn(t *testing.T) {
tk.MustExec("drop table if exists t5")
tk.MustExec("create table t5 (k char(10) primary key, v int)")
sql = "alter table t5 change column k k tinytext;"
tk.MustGetErrCode(sql, mysql.ErrBlobKeyWithoutLength)
tk.MustGetErrCode(sql, errno.ErrBlobKeyWithoutLength)
tk.MustExec("drop table t5")
tk.MustExec("drop table if exists t5")
tk.MustExec("create table t5 (k char(10), v int, INDEX(k))")
sql = "alter table t5 change column k k tinytext;"
tk.MustGetErrCode(sql, mysql.ErrBlobKeyWithoutLength)
tk.MustGetErrCode(sql, errno.ErrBlobKeyWithoutLength)
tk.MustExec("drop table t5")
tk.MustExec("drop table t3")
}
Expand Down
9 changes: 5 additions & 4 deletions pkg/ddl/column_type_change_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (

"github.com/pingcap/failpoint"
"github.com/pingcap/tidb/pkg/ddl"
"github.com/pingcap/tidb/pkg/errno"
"github.com/pingcap/tidb/pkg/kv"
"github.com/pingcap/tidb/pkg/meta/model"
"github.com/pingcap/tidb/pkg/parser/mysql"
Expand Down Expand Up @@ -175,10 +176,10 @@ var mockTerrorMap = make(map[string]*terror.Error)

func init() {
// Since terror new action will cause data race with other test suite (getTerrorCode) in parallel, we init it all here.
mockTerrorMap[model.StateNone.String()] = dbterror.ClassDDL.NewStdErr(1, mysql.Message("MockRollingBackInCallBack-"+model.StateNone.String(), nil))
mockTerrorMap[model.StateDeleteOnly.String()] = dbterror.ClassDDL.NewStdErr(1, mysql.Message("MockRollingBackInCallBack-"+model.StateDeleteOnly.String(), nil))
mockTerrorMap[model.StateWriteOnly.String()] = dbterror.ClassDDL.NewStdErr(1, mysql.Message("MockRollingBackInCallBack-"+model.StateWriteOnly.String(), nil))
mockTerrorMap[model.StateWriteReorganization.String()] = dbterror.ClassDDL.NewStdErr(1, mysql.Message("MockRollingBackInCallBack-"+model.StateWriteReorganization.String(), nil))
mockTerrorMap[model.StateNone.String()] = dbterror.ClassDDL.NewStdErr(1, errno.Message("MockRollingBackInCallBack-"+model.StateNone.String(), nil))
mockTerrorMap[model.StateDeleteOnly.String()] = dbterror.ClassDDL.NewStdErr(1, errno.Message("MockRollingBackInCallBack-"+model.StateDeleteOnly.String(), nil))
mockTerrorMap[model.StateWriteOnly.String()] = dbterror.ClassDDL.NewStdErr(1, errno.Message("MockRollingBackInCallBack-"+model.StateWriteOnly.String(), nil))
mockTerrorMap[model.StateWriteReorganization.String()] = dbterror.ClassDDL.NewStdErr(1, errno.Message("MockRollingBackInCallBack-"+model.StateWriteReorganization.String(), nil))
}

// Test issue #20529.
Expand Down
4 changes: 2 additions & 2 deletions pkg/ddl/ddl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (

"github.com/pingcap/tidb/pkg/ddl/testargsv1"
"github.com/pingcap/tidb/pkg/domain/infosync"
"github.com/pingcap/tidb/pkg/errno"
"github.com/pingcap/tidb/pkg/infoschema"
"github.com/pingcap/tidb/pkg/kv"
"github.com/pingcap/tidb/pkg/meta"
Expand All @@ -31,7 +32,6 @@ import (
"github.com/pingcap/tidb/pkg/parser"
"github.com/pingcap/tidb/pkg/parser/ast"
"github.com/pingcap/tidb/pkg/parser/charset"
"github.com/pingcap/tidb/pkg/parser/mysql"
"github.com/pingcap/tidb/pkg/parser/terror"
"github.com/pingcap/tidb/pkg/store/mockstore"
"github.com/pingcap/tidb/pkg/tablecodec"
Expand Down Expand Up @@ -209,7 +209,7 @@ func TestError(t *testing.T) {
}
for _, err := range kvErrs {
code := terror.ToSQLError(err).Code
require.NotEqual(t, mysql.ErrUnknown, code)
require.NotEqual(t, errno.ErrUnknown, code)
require.Equal(t, uint16(err.Code()), code)
}
}
Expand Down
38 changes: 19 additions & 19 deletions pkg/ddl/placement_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"github.com/pingcap/tidb/pkg/ddl/util"
"github.com/pingcap/tidb/pkg/domain"
"github.com/pingcap/tidb/pkg/domain/infosync"
mysql "github.com/pingcap/tidb/pkg/errno"
"github.com/pingcap/tidb/pkg/errno"
"github.com/pingcap/tidb/pkg/infoschema"
"github.com/pingcap/tidb/pkg/kv"
"github.com/pingcap/tidb/pkg/meta"
Expand Down Expand Up @@ -230,15 +230,15 @@ func testPlacementPolicy(t *testing.T) {

tk.MustGetErrCode("create placement policy x "+
"PRIMARY_REGION=\"cn-east-1\" "+
"REGIONS=\"cn-east-1,cn-east-2\" ", mysql.ErrPlacementPolicyExists)
"REGIONS=\"cn-east-1,cn-east-2\" ", errno.ErrPlacementPolicyExists)

tk.MustGetErrCode("create placement policy X "+
"PRIMARY_REGION=\"cn-east-1\" "+
"REGIONS=\"cn-east-1,cn-east-2\" ", mysql.ErrPlacementPolicyExists)
"REGIONS=\"cn-east-1,cn-east-2\" ", errno.ErrPlacementPolicyExists)

tk.MustGetErrCode("create placement policy `X` "+
"PRIMARY_REGION=\"cn-east-1\" "+
"REGIONS=\"cn-east-1,cn-east-2\" ", mysql.ErrPlacementPolicyExists)
"REGIONS=\"cn-east-1,cn-east-2\" ", errno.ErrPlacementPolicyExists)

tk.MustExec("create placement policy if not exists X " +
"PRIMARY_REGION=\"cn-east-1\" " +
Expand All @@ -250,7 +250,7 @@ func testPlacementPolicy(t *testing.T) {
require.Equal(t, len(bundles), 0)

tk.MustExec("drop placement policy x")
tk.MustGetErrCode("drop placement policy x", mysql.ErrPlacementPolicyNotExists)
tk.MustGetErrCode("drop placement policy x", errno.ErrPlacementPolicyNotExists)
tk.MustExec("drop placement policy if exists x")
//nolint:revive,all_revive
tk.MustQuery("show warnings").Check(testkit.Rows("Note 8239 Unknown placement policy 'x'"))
Expand Down Expand Up @@ -464,8 +464,8 @@ func TestResetSchemaPlacement(t *testing.T) {
tk := testkit.NewTestKit(t, store)
tk.MustExec("drop database if exists TestResetPlacementDB;")
tk.MustExec("create placement policy `TestReset` followers=4;")
tk.MustGetErrCode("create placement policy `default` followers=4;", mysql.ErrReservedSyntax)
tk.MustGetErrCode("create placement policy default followers=4;", mysql.ErrParse)
tk.MustGetErrCode("create placement policy `default` followers=4;", errno.ErrReservedSyntax)
tk.MustGetErrCode("create placement policy default followers=4;", errno.ErrParse)

tk.MustExec("create database TestResetPlacementDB placement policy `TestReset`;")
tk.MustExec("use TestResetPlacementDB")
Expand Down Expand Up @@ -607,8 +607,8 @@ func TestAlterPlacementPolicy(t *testing.T) {
// test alter not exist policies
tk.MustExec("drop table tp")
tk.MustExec("drop placement policy x")
tk.MustGetErrCode("alter placement policy x REGIONS=\"bj,sh\"", mysql.ErrPlacementPolicyNotExists)
tk.MustGetErrCode("alter placement policy x2 REGIONS=\"bj,sh\"", mysql.ErrPlacementPolicyNotExists)
tk.MustGetErrCode("alter placement policy x REGIONS=\"bj,sh\"", errno.ErrPlacementPolicyNotExists)
tk.MustGetErrCode("alter placement policy x2 REGIONS=\"bj,sh\"", errno.ErrPlacementPolicyNotExists)
tk.MustQuery("select * from INFORMATION_SCHEMA.PLACEMENT_POLICIES WHERE POLICY_NAME='x'").Check(testkit.Rows())
}

Expand Down Expand Up @@ -636,7 +636,7 @@ func TestCreateTableWithPlacementPolicy(t *testing.T) {

// Only placement policy should check the policy existence.
tk.MustGetErrCode("create table t(a int)"+
"PLACEMENT POLICY=\"x\"", mysql.ErrPlacementPolicyNotExists)
"PLACEMENT POLICY=\"x\"", errno.ErrPlacementPolicyNotExists)
tk.MustExec("create placement policy x " +
"FOLLOWERS=2 " +
"CONSTRAINTS=\"[+disk=ssd]\" ")
Expand Down Expand Up @@ -1098,7 +1098,7 @@ func TestAlterTablePartitionWithPlacementPolicy(t *testing.T) {

// Only placement policy should check the policy existence.
tk.MustGetErrCode("alter table t1 partition p0 "+
"PLACEMENT POLICY=\"x\"", mysql.ErrPlacementPolicyNotExists)
"PLACEMENT POLICY=\"x\"", errno.ErrPlacementPolicyNotExists)
tk.MustExec("create placement policy x " +
"FOLLOWERS=2 ")
tk.MustExec("alter table t1 partition p0 " +
Expand Down Expand Up @@ -2208,25 +2208,25 @@ func TestExchangePartitionWithPlacement(t *testing.T) {
checkExistTableBundlesInPD(t, dom, "test", "tp")

// exchange par2, t1
tk.MustGetErrCode("alter table tp exchange partition p2 with table t1", mysql.ErrTablesDifferentMetadata)
tk.MustGetErrCode("alter table tp exchange partition p2 with table t1", errno.ErrTablesDifferentMetadata)

// exchange par3, t1
tk.MustGetErrCode("alter table tp exchange partition p3 with table t1", mysql.ErrTablesDifferentMetadata)
tk.MustGetErrCode("alter table tp exchange partition p3 with table t1", errno.ErrTablesDifferentMetadata)

// exchange par1, t2
tk.MustGetErrCode("alter table tp exchange partition p1 with table t2", mysql.ErrTablesDifferentMetadata)
tk.MustGetErrCode("alter table tp exchange partition p1 with table t2", errno.ErrTablesDifferentMetadata)

// exchange par2, t2
tk.MustGetErrCode("alter table tp exchange partition p2 with table t2", mysql.ErrTablesDifferentMetadata)
tk.MustGetErrCode("alter table tp exchange partition p2 with table t2", errno.ErrTablesDifferentMetadata)

// exchange par3, t2
tk.MustGetErrCode("alter table tp exchange partition p3 with table t2", mysql.ErrTablesDifferentMetadata)
tk.MustGetErrCode("alter table tp exchange partition p3 with table t2", errno.ErrTablesDifferentMetadata)

// exchange par1, t3
tk.MustGetErrCode("alter table tp exchange partition p1 with table t3", mysql.ErrTablesDifferentMetadata)
tk.MustGetErrCode("alter table tp exchange partition p1 with table t3", errno.ErrTablesDifferentMetadata)

// exchange par2, t3
tk.MustGetErrCode("alter table tp exchange partition p2 with table t3", mysql.ErrTablesDifferentMetadata)
tk.MustGetErrCode("alter table tp exchange partition p2 with table t3", errno.ErrTablesDifferentMetadata)

// exchange par3, t3
tk.MustExec("alter table tp exchange partition p3 with table t3")
Expand Down Expand Up @@ -2312,7 +2312,7 @@ func TestPDFail(t *testing.T) {
checkAllBundlesNotChange(t, existBundles)

// exchange partition
tk.MustGetErrCode("alter table tp exchange partition p1 with table t1", mysql.ErrTablesDifferentMetadata)
tk.MustGetErrCode("alter table tp exchange partition p1 with table t1", errno.ErrTablesDifferentMetadata)
tk.MustQuery("show create table t1").Check(testkit.Rows("t1 CREATE TABLE `t1` (\n" +
" `id` int(11) DEFAULT NULL\n" +
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin"))
Expand Down
4 changes: 2 additions & 2 deletions pkg/ddl/placement_sql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/pingcap/tidb/pkg/ddl"
"github.com/pingcap/tidb/pkg/domain"
"github.com/pingcap/tidb/pkg/domain/infosync"
mysql "github.com/pingcap/tidb/pkg/errno"
"github.com/pingcap/tidb/pkg/errno"
"github.com/pingcap/tidb/pkg/meta/model"
"github.com/pingcap/tidb/pkg/parser/ast"
"github.com/pingcap/tidb/pkg/sessionctx"
Expand Down Expand Up @@ -210,7 +210,7 @@ func TestAlterDBPlacement(t *testing.T) {

// Policy Test
// Test for Non-Exist policy
tk.MustGetErrCode("ALTER DATABASE TestAlterDB PLACEMENT POLICY=`alter_z`;", mysql.ErrPlacementPolicyNotExists)
tk.MustGetErrCode("ALTER DATABASE TestAlterDB PLACEMENT POLICY=`alter_z`;", errno.ErrPlacementPolicyNotExists)
tk.MustQuery("SELECT CATALOG_NAME, SCHEMA_NAME, DEFAULT_CHARACTER_SET_NAME, DEFAULT_COLLATION_NAME, TIDB_PLACEMENT_POLICY_NAME FROM information_schema.schemata WHERE SCHEMA_NAME='TestAlterDB'").Check(testkit.Rows(`def TestAlterDB utf8mb4 utf8mb4_bin <nil>`))

tk.MustExec("ALTER DATABASE TestAlterDB PLACEMENT POLICY=`alter_x`;")
Expand Down
18 changes: 9 additions & 9 deletions pkg/ddl/sequence_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"testing"
"time"

mysql "github.com/pingcap/tidb/pkg/errno"
"github.com/pingcap/tidb/pkg/errno"
"github.com/pingcap/tidb/pkg/meta/model"
"github.com/pingcap/tidb/pkg/parser/auth"
"github.com/pingcap/tidb/pkg/session"
Expand All @@ -34,30 +34,30 @@ func TestCreateSequence(t *testing.T) {
tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
tk.MustExec("drop sequence if exists seq")
tk.MustGetErrCode("create sequence `seq `", mysql.ErrWrongTableName)
tk.MustGetErrCode("create sequence `seq `", errno.ErrWrongTableName)

// increment should not be set as 0.
tk.MustGetErrCode("create sequence seq increment 0", mysql.ErrSequenceInvalidData)
tk.MustGetErrCode("create sequence seq increment 0", errno.ErrSequenceInvalidData)

// maxvalue should be larger than minvalue.
tk.MustGetErrCode("create sequence seq maxvalue 1 minvalue 2", mysql.ErrSequenceInvalidData)
tk.MustGetErrCode("create sequence seq maxvalue 1 minvalue 2", errno.ErrSequenceInvalidData)

// maxvalue should be larger than minvalue.
tk.MustGetErrCode("create sequence seq maxvalue 1 minvalue 1", mysql.ErrSequenceInvalidData)
tk.MustGetErrCode("create sequence seq maxvalue 1 minvalue 1", errno.ErrSequenceInvalidData)

// maxvalue shouldn't be equal to MaxInt64.
tk.MustGetErrCode("create sequence seq maxvalue 9223372036854775807 minvalue 1", mysql.ErrSequenceInvalidData)
tk.MustGetErrCode("create sequence seq maxvalue 9223372036854775807 minvalue 1", errno.ErrSequenceInvalidData)

// TODO : minvalue shouldn't be equal to MinInt64.

// maxvalue should be larger than start.
tk.MustGetErrCode("create sequence seq maxvalue 1 start with 2", mysql.ErrSequenceInvalidData)
tk.MustGetErrCode("create sequence seq maxvalue 1 start with 2", errno.ErrSequenceInvalidData)

// cacheVal should be less than (math.MaxInt64-maxIncrement)/maxIncrement.
tk.MustGetErrCode("create sequence seq increment 100000 cache 922337203685477", mysql.ErrSequenceInvalidData)
tk.MustGetErrCode("create sequence seq increment 100000 cache 922337203685477", errno.ErrSequenceInvalidData)

// test unsupported table option in sequence.
tk.MustGetErrCode("create sequence seq CHARSET=utf8", mysql.ErrSequenceUnsupportedTableOption)
tk.MustGetErrCode("create sequence seq CHARSET=utf8", errno.ErrSequenceUnsupportedTableOption)

tk.MustExec("create sequence seq comment=\"test\"")

Expand Down
32 changes: 16 additions & 16 deletions pkg/ddl/tests/metadatalock/mdl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/pingcap/failpoint"
"github.com/pingcap/tidb/pkg/ddl"
ingesttestutil "github.com/pingcap/tidb/pkg/ddl/ingest/testutil"
mysql "github.com/pingcap/tidb/pkg/errno"
"github.com/pingcap/tidb/pkg/errno"
"github.com/pingcap/tidb/pkg/meta/model"
"github.com/pingcap/tidb/pkg/server"
"github.com/pingcap/tidb/pkg/testkit"
Expand Down Expand Up @@ -330,15 +330,15 @@ func TestMDLRRUpdateSchema(t *testing.T) {
tk.MustExec("begin")
tkDDL.MustExec("alter table test.t add index idx(a);")
tk.MustQuery("select * from t").Check(testkit.Rows("1 <nil>"))
tk.MustGetErrCode("select * from t use index(idx)", mysql.ErrKeyDoesNotExist)
tk.MustGetErrCode("select * from t use index(idx)", errno.ErrKeyDoesNotExist)
tk.MustExec("commit")
tk.MustQuery("select * from t use index(idx)").Check(testkit.Rows("1 <nil>"))

// Modify column(reorg).
tk.MustExec("begin")
tkDDL.MustExec("alter table test.t modify column a char(10);")
tk.MustGetErrCode("select * from t", mysql.ErrInfoSchemaChanged)
tk.MustGetErrCode("select * from t", mysql.ErrInfoSchemaChanged)
tk.MustGetErrCode("select * from t", errno.ErrInfoSchemaChanged)
tk.MustGetErrCode("select * from t", errno.ErrInfoSchemaChanged)
tk.MustExec("commit")
tk.MustQuery("select * from t").Check(testkit.Rows("1 <nil>"))

Expand Down Expand Up @@ -1113,7 +1113,7 @@ func TestMDLDisable2Enable(t *testing.T) {

wg.Wait()

tk.MustGetErrCode("commit", mysql.ErrInfoSchemaChanged)
tk.MustGetErrCode("commit", errno.ErrInfoSchemaChanged)
tk3.MustExec("commit")
tk.MustExec("admin check table t")
}
Expand Down Expand Up @@ -1153,7 +1153,7 @@ func TestMDLEnable2Disable(t *testing.T) {

wg.Wait()

tk.MustGetErrCode("commit", mysql.ErrInfoSchemaChanged)
tk.MustGetErrCode("commit", errno.ErrInfoSchemaChanged)
tk3.MustExec("commit")
tk.MustExec("admin check table t")
}
Expand Down Expand Up @@ -1322,11 +1322,11 @@ func TestMDLTableCreate(t *testing.T) {

tk.MustExec("begin")
tk.MustQuery("select * from t;")
tk.MustGetErrCode("select * from t1;", mysql.ErrNoSuchTable)
tk.MustGetErrCode("select * from t1;", errno.ErrNoSuchTable)

tkDDL.MustExec("create table test.t1(a int);")

tk.MustGetErrCode("select * from t1;", mysql.ErrNoSuchTable)
tk.MustGetErrCode("select * from t1;", errno.ErrNoSuchTable)

tk.MustExec("commit")
}
Expand All @@ -1346,7 +1346,7 @@ func TestMDLTableDrop(t *testing.T) {

tkDDL.MustExec("drop table test.t;")

tk.MustGetErrCode("select * from t;", mysql.ErrNoSuchTable)
tk.MustGetErrCode("select * from t;", errno.ErrNoSuchTable)

tk.MustExec("commit")
}
Expand All @@ -1365,8 +1365,8 @@ func TestMDLDatabaseCreate(t *testing.T) {
tkDDL.MustExec("create database test2;")
tkDDL.MustExec("create table test2.t(a int);")

tk.MustGetErrCode("use test2", mysql.ErrBadDB)
tk.MustGetErrCode("select * from test2.t;", mysql.ErrNoSuchTable)
tk.MustGetErrCode("use test2", errno.ErrBadDB)
tk.MustGetErrCode("select * from test2.t;", errno.ErrNoSuchTable)

tk.MustExec("commit")
}
Expand All @@ -1387,7 +1387,7 @@ func TestMDLDatabaseDrop(t *testing.T) {
tkDDL.MustExec("drop database test;")

tk.MustExec("use test;")
tk.MustGetErrCode("select * from t;", mysql.ErrNoSuchTable)
tk.MustGetErrCode("select * from t;", errno.ErrNoSuchTable)

tk.MustExec("commit")
}
Expand All @@ -1407,17 +1407,17 @@ func TestMDLRenameTable(t *testing.T) {

tkDDL.MustExec("rename table test.t to test.t1;")

tk.MustGetErrCode("select * from t;", mysql.ErrNoSuchTable)
tk.MustGetErrCode("select * from t1;", mysql.ErrNoSuchTable)
tk.MustGetErrCode("select * from t;", errno.ErrNoSuchTable)
tk.MustGetErrCode("select * from t1;", errno.ErrNoSuchTable)

tk.MustExec("commit")
tk.MustExec("create database test2")
tk.MustExec("begin")

tkDDL.MustExec("rename table test.t1 to test2.t1;")

tk.MustGetErrCode("select * from t1;", mysql.ErrNoSuchTable)
tk.MustGetErrCode("select * from test2.t1;", mysql.ErrNoSuchTable)
tk.MustGetErrCode("select * from t1;", errno.ErrNoSuchTable)
tk.MustGetErrCode("select * from test2.t1;", errno.ErrNoSuchTable)
tk.MustExec("commit")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/ddl/tests/partition/db_partition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func TestCreateTableWithPartition(t *testing.T) {
partition p1 values less than (19xx91),
partition p2 values less than maxvalue
);`
tk.MustGetErrCode(sql18, mysql.ErrBadField)
tk.MustGetErrCode(sql18, errno.ErrBadField)

sql9 := `create TABLE t9 (
col1 int
Expand Down
Loading
Loading