Skip to content

Commit

Permalink
address comment, support primary key without column defs
Browse files Browse the repository at this point in the history
Signed-off-by: lysu <sulifx@gmail.com>
  • Loading branch information
lysu committed Mar 11, 2021
1 parent 404be82 commit b54bf6e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion sessionctx/binloginfo/binloginfo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -619,8 +619,12 @@ func (s *testBinlogSuite) TestAddSpecialComment(c *C) {
"create table t1(id int, v int, primary key(a) /*T![clustered_index] clustered */ );",
},
{
"create table t1(id int primary key clustered, v int);", // CDC upstream => downstream never produce this
"create table t1(id int primary key clustered, v int);",
"create table t1(id int primary key /*T![clustered_index] clustered */ , v int);",
},
{
"alter table t add primary key(a) clustered;",
"alter table t add primary key(a) /*T![clustered_index] clustered */ ;",
},
{
"create table t1 (id int, a varchar(255), primary key (a, b) nonclustered);",
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 @@ -68,5 +68,5 @@ var FeatureIDPatterns = map[featureID]*regexp.Regexp{
FeatureIDAutoRandom: regexp.MustCompile(`(?P<REPLACE>(?i)AUTO_RANDOM\b\s*(\s*\(\s*\d+\s*\)\s*)?)`),
FeatureIDAutoIDCache: regexp.MustCompile(`(?P<REPLACE>(?i)AUTO_ID_CACHE\s*=?\s*\d+\s*)`),
FeatureIDAutoRandomBase: regexp.MustCompile(`(?P<REPLACE>(?i)AUTO_RANDOM_BASE\s*=?\s*\d+\s*)`),
FeatureClusteredIndex: regexp.MustCompile(`(?i)PRIMARY\s+KEY\s*\(.*\)\s+(?P<REPLACE>(NON)?CLUSTERED\b)`),
FeatureClusteredIndex: regexp.MustCompile(`(?i)PRIMARY\s+KEY(\s*\(.*\))?\s+(?P<REPLACE>(NON)?CLUSTERED\b)`),
}

0 comments on commit b54bf6e

Please sign in to comment.