parser: change keyword TiDB_CURRENT_TSO to TIDB_CURRENT_TSO (#55258)

close pingcap/tidb#55208
This commit is contained in:
Hangjie Mo
2024-08-08 11:00:40 +08:00
committed by GitHub
parent 1ee9efa51b
commit f6fe03d2d1
6 changed files with 22 additions and 24 deletions

View File

@ -76,8 +76,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+)"$`)

View File

@ -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")
}

View File

@ -222,6 +222,7 @@ 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"},
@ -229,7 +230,6 @@ var Keywords = []KeywordsType{
{"TRAILING", true, "reserved"},
{"TRIGGER", true, "reserved"},
{"TRUE", true, "reserved"},
{"TiDB_CURRENT_TSO", true, "reserved"},
{"UNION", true, "reserved"},
{"UNIQUE", true, "reserved"},
{"UNLOCK", true, "reserved"},

View File

@ -814,7 +814,7 @@ const (
then = 57559
tiFlash = 58159
tidb = 58158
tidbCurrentTSO = 57567
tidbCurrentTSO = 57560
tidbJson = 58065
tikvImporter = 57936
timeDuration = 58066
@ -822,11 +822,11 @@ const (
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
@ -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
@ -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)
@ -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)
@ -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)
@ -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)
@ -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)
@ -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)

View File

@ -274,6 +274,7 @@ import (
tableSample "TABLESAMPLE"
terminated "TERMINATED"
then "THEN"
tidbCurrentTSO "TIDB_CURRENT_TSO"
tinyblobType "TINYBLOB"
tinyIntType "TINYINT"
tinytextType "TINYTEXT"
@ -281,7 +282,6 @@ import (
trailing "TRAILING"
trigger "TRIGGER"
trueKwd "TRUE"
tidbCurrentTSO "TiDB_CURRENT_TSO"
union "UNION"
unique "UNIQUE"
unlock "UNLOCK"
@ -7950,7 +7950,7 @@ FunctionNameOptionalBraces:
| "CURRENT_DATE"
| "CURRENT_ROLE"
| "UTC_DATE"
| "TiDB_CURRENT_TSO"
| "TIDB_CURRENT_TSO"
FunctionNameDatetimePrecision:
"CURRENT_TIME"

View File

@ -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.