Skip to content

Commit

Permalink
driver: fix auto_random keyword regex (#17915) (#17955)
Browse files Browse the repository at this point in the history
Signed-off-by: sre-bot <[email protected]>
  • Loading branch information
sre-bot authored Jul 21, 2020
1 parent 71dc437 commit 5a38c11
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions sessionctx/binloginfo/binloginfo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,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);",
Expand Down
2 changes: 1 addition & 1 deletion types/parser_driver/special_cmt_ctrl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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*`),
}

0 comments on commit 5a38c11

Please sign in to comment.