diff --git a/pkg/parser/reserved_words_test.go b/pkg/parser/reserved_words_test.go index 6e409145ba428..35eed1f0aee30 100644 --- a/pkg/parser/reserved_words_test.go +++ b/pkg/parser/reserved_words_test.go @@ -65,8 +65,14 @@ func TestCompareReservedWordsWithMySQL(t *testing.T) { for _, kw := range reservedKeywords { switch kw { - case "CURRENT_ROLE", "INTERSECT", "STATS_EXTENDED", "TABLESAMPLE": - // special case: we do reserve these words but MySQL didn't, + case "CURRENT_ROLE", // Present in both, reserved only in TiDB + "STATS_EXTENDED", // Only in TiDB + "TABLESAMPLE", // Only in TiDB + "ARRAY", // added in 8.0.17 (reserved); became nonreserved in 8.0.19 + "ILIKE", // Only in TiDB + "TiDB_CURRENT_TSO", // Only in TiDB + "UNTIL": // Present in both, reserved only in TiDB + // special cases: we do reserve these words but MySQL didn't, // and unreservering it causes legit parser conflict. continue } @@ -83,15 +89,18 @@ func TestCompareReservedWordsWithMySQL(t *testing.T) { requires.Regexp(t, errRegexp, err.Error()) } _, err = db.Exec(query) - requires.Error(t, err) + requires.Error(t, err, query) requires.Regexp(t, errRegexp, err.Error(), "MySQL suggests that '%s' should *not* be reserved!", kw) } for _, kws := range [][]string{unreservedKeywords, notKeywordTokens, tidbKeywords} { for _, kw := range kws { switch kw { - case "FUNCTION", // reserved in 8.0.1 - "PURGE", "SYSTEM", "SEPARATOR": // ? + case "FUNCTION", // Reserved in MySQL 8.0.1 + "PURGE", // Reserved in MySQL + "SYSTEM", // Reserved in MySQL 8.0.3 + "SEPARATOR", // Reserved in MySQL + "DECLARE": // Reserved in MySQL continue } @@ -103,7 +112,6 @@ func TestCompareReservedWordsWithMySQL(t *testing.T) { requires.IsType(t, &ast.DoStmt{}, stmts[0]) _, err = db.Exec(query) - println(query) requires.NoErrorf(t, err, "MySQL suggests that '%s' should be reserved!", kw) } }