Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parser: change keyword TiDB_CURRENT_TSO to TIDB_CURRENT_TSO #55258

Merged
merged 3 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions pkg/parser/generate_keyword/genkeyword.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ var keywordRe *regexp.Regexp
// example data:
//
// add "ADD"
//
// Note that all keywords except `TiDB_CURRENT_TSO` are fully uppercase.
func parseLine(line string) string {
if keywordRe == nil {
keywordRe = regexp.MustCompile(`^\s+\w+\s+"(\w+)"$`)
Expand Down
4 changes: 2 additions & 2 deletions pkg/parser/generate_keyword/genkeyword_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ func TestParseLine(t *testing.T) {
add := parseLine(" add \"ADD\"")
require.Equal(t, add, "ADD")

tso := parseLine(" tidbCurrentTSO \"TiDB_CURRENT_TSO\"")
require.Equal(t, tso, "TiDB_CURRENT_TSO")
tso := parseLine(" tidbCurrentTSO \"TIDB_CURRENT_TSO\"")
require.Equal(t, tso, "TIDB_CURRENT_TSO")
}
2 changes: 1 addition & 1 deletion pkg/parser/keywords.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,14 @@ var Keywords = []KeywordsType{
{"TABLESAMPLE", true, "reserved"},
{"TERMINATED", true, "reserved"},
{"THEN", true, "reserved"},
{"TIDB_CURRENT_TSO", true, "reserved"},
{"TINYBLOB", true, "reserved"},
{"TINYINT", true, "reserved"},
{"TINYTEXT", true, "reserved"},
{"TO", true, "reserved"},
{"TRAILING", true, "reserved"},
{"TRIGGER", true, "reserved"},
{"TRUE", true, "reserved"},
{"TiDB_CURRENT_TSO", true, "reserved"},
{"UNION", true, "reserved"},
{"UNIQUE", true, "reserved"},
{"UNLOCK", true, "reserved"},
Expand Down
32 changes: 16 additions & 16 deletions pkg/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -814,19 +814,19 @@ const (
then = 57559
tiFlash = 58159
tidb = 58158
tidbCurrentTSO = 57567
tidbCurrentTSO = 57560
tidbJson = 58065
tikvImporter = 57936
timeDuration = 58066
timeType = 57937
timestampAdd = 58067
timestampDiff = 58068
timestampType = 57938
tinyIntType = 57561
tinyblobType = 57560
tinytextType = 57562
tinyIntType = 57562
tinyblobType = 57561
tinytextType = 57563
tls = 58069
to = 57563
to = 57564
toTSO = 57349
toTimestamp = 57348
tokenIssuer = 57939
Expand All @@ -846,13 +846,13 @@ const (
tpch10 = 57941
trace = 57942
traditional = 57943
trailing = 57564
trailing = 57565
transaction = 57944
trigger = 57565
trigger = 57566
triggers = 57945
trim = 58080
trueCardCost = 58081
trueKwd = 57566
trueKwd = 57567
truncate = 57946
tsoType = 57947
ttl = 57948
Expand Down Expand Up @@ -1571,7 +1571,7 @@ var (
57371: 641, // between (835x)
57425: 642, // falseKwd (833x)
57354: 643, // singleAtIdentifier (833x)
57566: 644, // trueKwd (833x)
57567: 644, // trueKwd (833x)
57396: 645, // currentUser (828x)
57447: 646, // ilike (827x)
57526: 647, // regexpKwd (827x)
Expand Down Expand Up @@ -1639,7 +1639,7 @@ var (
57516: 709, // percentRank (804x)
57521: 710, // rank (804x)
57538: 711, // rowNumber (804x)
57567: 712, // tidbCurrentTSO (804x)
57560: 712, // tidbCurrentTSO (804x)
57577: 713, // utcDate (804x)
57578: 714, // utcTime (804x)
57579: 715, // utcTimestamp (804x)
Expand All @@ -1653,7 +1653,7 @@ var (
57382: 723, // character (768x)
57449: 724, // index (752x)
57488: 725, // match (739x)
57563: 726, // to (647x)
57564: 726, // to (647x)
57366: 727, // analyze (641x)
57573: 728, // update (637x)
46: 729, // '.' (626x)
Expand Down Expand Up @@ -1703,9 +1703,9 @@ var (
57493: 773, // middleIntType (552x)
57503: 774, // numericType (552x)
57543: 775, // smallIntType (552x)
57560: 776, // tinyblobType (552x)
57561: 777, // tinyIntType (552x)
57562: 778, // tinytextType (552x)
57561: 776, // tinyblobType (552x)
57562: 777, // tinyIntType (552x)
57563: 778, // tinytextType (552x)
57348: 779, // toTimestamp (552x)
57349: 780, // toTSO (552x)
57380: 781, // change (550x)
Expand Down Expand Up @@ -2032,7 +2032,7 @@ var (
58799: 1102, // TableOrTables (3x)
58811: 1103, // TextType (3x)
58818: 1104, // TransactionChars (3x)
57565: 1105, // trigger (3x)
57566: 1105, // trigger (3x)
58821: 1106, // Type (3x)
57570: 1107, // unlock (3x)
57572: 1108, // until (3x)
Expand Down Expand Up @@ -2430,7 +2430,7 @@ var (
58804: 1500, // TableSampleOpt (1x)
58805: 1501, // TableSampleUnitOpt (1x)
58807: 1502, // TableToTableList (1x)
57564: 1503, // trailing (1x)
57565: 1503, // trailing (1x)
58819: 1504, // TrimDirection (1x)
58831: 1505, // UserToUserList (1x)
58833: 1506, // UserVariableList (1x)
Expand Down
4 changes: 2 additions & 2 deletions pkg/parser/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -274,14 +274,14 @@ import (
tableSample "TABLESAMPLE"
terminated "TERMINATED"
then "THEN"
tidbCurrentTSO "TIDB_CURRENT_TSO"
tinyblobType "TINYBLOB"
tinyIntType "TINYINT"
tinytextType "TINYTEXT"
to "TO"
trailing "TRAILING"
trigger "TRIGGER"
trueKwd "TRUE"
tidbCurrentTSO "TiDB_CURRENT_TSO"
union "UNION"
unique "UNIQUE"
unlock "UNLOCK"
Expand Down Expand Up @@ -7950,7 +7950,7 @@ FunctionNameOptionalBraces:
| "CURRENT_DATE"
| "CURRENT_ROLE"
| "UTC_DATE"
| "TiDB_CURRENT_TSO"
| "TIDB_CURRENT_TSO"

FunctionNameDatetimePrecision:
"CURRENT_TIME"
Expand Down
2 changes: 1 addition & 1 deletion pkg/parser/reserved_words_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func TestCompareReservedWordsWithMySQL(t *testing.T) {
"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
"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.
Expand Down