diff --git a/sessionctx/binloginfo/binloginfo_test.go b/sessionctx/binloginfo/binloginfo_test.go index 72f255ad70d42..89622fe6c226c 100644 --- a/sessionctx/binloginfo/binloginfo_test.go +++ b/sessionctx/binloginfo/binloginfo_test.go @@ -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);", diff --git a/types/parser_driver/special_cmt_ctrl.go b/types/parser_driver/special_cmt_ctrl.go index 748bbffc5ec0d..ffa26636981c5 100644 --- a/types/parser_driver/special_cmt_ctrl.go +++ b/types/parser_driver/special_cmt_ctrl.go @@ -68,5 +68,5 @@ var FeatureIDPatterns = map[featureID]*regexp.Regexp{ FeatureIDAutoRandom: regexp.MustCompile(`(?P(?i)AUTO_RANDOM\b\s*(\s*\(\s*\d+\s*\)\s*)?)`), FeatureIDAutoIDCache: regexp.MustCompile(`(?P(?i)AUTO_ID_CACHE\s*=?\s*\d+\s*)`), FeatureIDAutoRandomBase: regexp.MustCompile(`(?P(?i)AUTO_RANDOM_BASE\s*=?\s*\d+\s*)`), - FeatureClusteredIndex: regexp.MustCompile(`(?i)PRIMARY\s+KEY\s*\(.*\)\s+(?P(NON)?CLUSTERED\b)`), + FeatureClusteredIndex: regexp.MustCompile(`(?i)PRIMARY\s+KEY(\s*\(.*\))?\s+(?P(NON)?CLUSTERED\b)`), }