diff --git a/sessionctx/binloginfo/binloginfo_test.go b/sessionctx/binloginfo/binloginfo_test.go index 526d280ec9243..e33c17e3b26e6 100644 --- a/sessionctx/binloginfo/binloginfo_test.go +++ b/sessionctx/binloginfo/binloginfo_test.go @@ -551,6 +551,10 @@ func (s *testBinlogSuite) TestAddSpecialComment(c *C) { "create table t1 (id int primary key auto_random(2));", "create table t1 (id int primary key /*T![auto_rand] auto_random(2) */ );", }, + { + "create table t1 (id int primary key auto_random);", + "create table t1 (id int primary key /*T![auto_rand] auto_random */ );", + }, { "create table t1 (id int auto_random ( 4 ) primary key);", "create table t1 (id int /*T![auto_rand] auto_random ( 4 ) */ primary key);", diff --git a/types/parser_driver/special_cmt_ctrl.go b/types/parser_driver/special_cmt_ctrl.go index ad34ae2307985..c1b018b685705 100644 --- a/types/parser_driver/special_cmt_ctrl.go +++ b/types/parser_driver/special_cmt_ctrl.go @@ -62,7 +62,7 @@ const ( // FeatureIDPatterns is used to record special comments patterns. var FeatureIDPatterns = map[featureID]*regexp.Regexp{ - FeatureIDAutoRandom: regexp.MustCompile(`(?i)AUTO_RANDOM\s*(\(\s*\d+\s*\)|\s+)\s*`), + FeatureIDAutoRandom: regexp.MustCompile(`(?i)AUTO_RANDOM\b\s*(\s*\(\s*\d+\s*\)\s*)?`), FeatureIDAutoIDCache: regexp.MustCompile(`(?i)AUTO_ID_CACHE\s*=?\s*\d+\s*`), FeatureIDAutoRandomBase: regexp.MustCompile(`(?i)AUTO_RANDOM_BASE\s*=?\s*\d+\s*`), }