Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion infoschema/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ go_test(
],
embed = [":infoschema"],
flaky = True,
shard_count = 9,
shard_count = 10,
deps = [
"//ddl/placement",
"//domain",
Expand Down
6 changes: 6 additions & 0 deletions infoschema/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,12 @@ func (b *Builder) applyCreateTable(m *meta.Meta, dbInfo *model.DBInfo, tableID i
}

switch tp {
case model.ActionRenameTable, model.ActionRenameTables:
if tableNames, ok := b.is.schemaMap[dbInfo.Name.L]; ok {
if _, ok = tableNames.tables[tblInfo.Name.L]; ok {
return affected, nil
}
}
case model.ActionDropTablePartition:
case model.ActionTruncateTablePartition:
// ReorganizePartition handle the bundles in applyReorganizePartition
Expand Down
12 changes: 12 additions & 0 deletions infoschema/infoschema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -822,3 +822,15 @@ func TestIssue42400(t *testing.T) {
tk.MustQuery("show create table information_schema.ddl_jobs").CheckContain("`QUERY` text")
tk.MustQuery("select length(query) from information_schema.ddl_jobs;") // No error
}

func TestInfoSchemaRenameTable(t *testing.T) {
store := testkit.CreateMockStore(t)

tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
tk.MustExec("create table test.t1 (id int primary key,a text);")
tk.MustExec("insert test.t1 values(1,'334'),(4,'3443435'),(5,'fdf43t536653');")
tk.MustExec("rename table test.t1 to mysql.t1;")
tk.MustQuery("SELECT count(*) FROM information_schema.TABLES WHERE (TABLE_SCHEMA = 'mysql') AND (TABLE_NAME = 't1');").
Check(testkit.Rows("1"))
}