Skip to content

Commit

Permalink
fix auto random base comment in show.go (#16859) (#16864)
Browse files Browse the repository at this point in the history
  • Loading branch information
sre-bot authored Apr 27, 2020
1 parent 28a2e49 commit 3b81a7f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion executor/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ func ConstructResultOfShowCreateTable(ctx sessionctx.Context, tableInfo *model.T
}

if tableInfo.AutoRandID != 0 {
fmt.Fprintf(buf, " /*T![auto_rand] AUTO_RANDOM_BASE=%d */", tableInfo.AutoRandID)
fmt.Fprintf(buf, " /*T![auto_rand_base] AUTO_RANDOM_BASE=%d */", tableInfo.AutoRandID)
}

if tableInfo.ShardRowIDBits > 0 {
Expand Down
6 changes: 3 additions & 3 deletions executor/show_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ func (s *testAutoRandomSuite) TestShowCreateTableAutoRandom(c *C) {
" `a` bigint(20) NOT NULL /*T![auto_rand] AUTO_RANDOM(5) */,\n"+
" `b` varchar(255) DEFAULT NULL,\n"+
" PRIMARY KEY (`a`)\n"+
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin /*T![auto_rand] AUTO_RANDOM_BASE=100 */",
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin /*T![auto_rand_base] AUTO_RANDOM_BASE=100 */",
))
// Test implicit auto_random with auto_random table option.
tk.MustExec("create table auto_random_tbl5 (a bigint auto_random primary key, b char) auto_random_base 50")
Expand All @@ -734,7 +734,7 @@ func (s *testAutoRandomSuite) TestShowCreateTableAutoRandom(c *C) {
" `a` bigint(20) NOT NULL /*T![auto_rand] AUTO_RANDOM(5) */,\n"+
" `b` char(1) DEFAULT NULL,\n"+
" PRIMARY KEY (`a`)\n"+
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin /*T![auto_rand] AUTO_RANDOM_BASE=50 */",
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin /*T![auto_rand_base] AUTO_RANDOM_BASE=50 */",
))
// Test auto_random table option already with special comment.
tk.MustExec("create table auto_random_tbl6 (a bigint /*T![auto_rand] auto_random */ primary key) auto_random_base 200")
Expand All @@ -743,7 +743,7 @@ func (s *testAutoRandomSuite) TestShowCreateTableAutoRandom(c *C) {
"auto_random_tbl6 CREATE TABLE `auto_random_tbl6` (\n"+
" `a` bigint(20) NOT NULL /*T![auto_rand] AUTO_RANDOM(5) */,\n"+
" PRIMARY KEY (`a`)\n"+
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin /*T![auto_rand] AUTO_RANDOM_BASE=200 */",
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin /*T![auto_rand_base] AUTO_RANDOM_BASE=200 */",
))
}

Expand Down

0 comments on commit 3b81a7f

Please sign in to comment.