diff --git a/keywords.md b/keywords.md
index 0b01ec5d6db69..6ec73ce075f78 100644
--- a/keywords.md
+++ b/keywords.md
@@ -66,7 +66,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- ACCOUNT
- ACTION
- ADD (R)
-- ADMIN (R)
+- ADMIN
- ADVISE
- AFTER
- AGAINST
@@ -96,6 +96,8 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- BACKEND
- BACKUP
- BACKUPS
+- BATCH
+- BDR
- BEGIN
- BERNOULLI
- BETWEEN (R)
@@ -112,8 +114,8 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- BOOLEAN
- BOTH (R)
- BTREE
-- BUCKETS (R)
-- BUILTINS (R)
+- BUCKETS
+- BUILTINS
- BY (R)
- BYTE
@@ -122,8 +124,9 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- CACHE
- CALIBRATE
- CALL (R)
-- CANCEL (R)
+- CANCEL
- CAPTURE
+- CARDINALITY
- CASCADE (R)
- CASCADED
- CASE (R)
@@ -143,12 +146,13 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- CLOSE
- CLUSTER
- CLUSTERED
-- CMSKETCH (R)
+- CMSKETCH
- COALESCE
- COLLATE (R)
- COLLATION
- COLUMN (R)
- COLUMN_FORMAT
+- COLUMN_STATS_USAGE
- COLUMNS
- COMMENT
- COMMIT
@@ -165,6 +169,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- CONTEXT
- CONTINUE (R)
- CONVERT (R)
+- CORRELATION
- CPU
- CREATE (R)
- CROSS (R)
@@ -197,7 +202,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- DAY_MICROSECOND (R)
- DAY_MINUTE (R)
- DAY_SECOND (R)
-- DDL (R)
+- DDL
- DEALLOCATE
- DECIMAL (R)
- DECLARE
@@ -207,7 +212,8 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- DELAYED (R)
- DELETE (R)
- DENSE_RANK (R-Window)
-- DEPTH (R)
+- DEPENDENCY
+- DEPTH
- DESC (R)
- DESCRIBE (R)
- DIGEST
@@ -221,8 +227,9 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- DIV (R)
- DO
- DOUBLE (R)
-- DRAINER (R)
+- DRAINER
- DROP (R)
+- DRY
- DUAL (R)
- DUPLICATE
- DYNAMIC
@@ -300,6 +307,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- HELP
- HIGH_PRIORITY (R)
- HISTOGRAM
+- HISTOGRAMS_IN_FLIGHT
- HISTORY
- HOSTS
- HOUR
@@ -347,8 +355,8 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
J
-- JOB (R)
-- JOBS (R)
+- JOB
+- JOBS
- JOIN (R)
- JSON
@@ -381,6 +389,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- LIST
- LOAD (R)
- LOCAL
+- LOCAL_ONLY
- LOCALTIME (R)
- LOCALTIMESTAMP (R)
- LOCATION
@@ -435,8 +444,8 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- NOCACHE
- NOCYCLE
- NODEGROUP
-- NODE_ID (R)
-- NODE_STATE (R)
+- NODE_ID
+- NODE_STATE
- NOMAXVALUE
- NOMINVALUE
- NONCLUSTERED
@@ -464,7 +473,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- ONLINE
- ONLY
- OPEN
-- OPTIMISTIC (R)
+- OPTIMISTIC
- OPTIMIZE (R)
- OPTION (R)
- OPTIONAL
@@ -492,7 +501,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- PERCENT_RANK (R-Window)
- PER_DB
- PER_TABLE
-- PESSIMISTIC (R)
+- PESSIMISTIC
- PLACEMENT (S)
- PLUGINS
- POINT
@@ -510,7 +519,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- PROFILE
- PROFILES
- PROXY
-- PUMP (R)
+- PUMP
- PURGE
Q
@@ -533,8 +542,8 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- REDUNDANT
- REFERENCES (R)
- REGEXP (R)
-- REGION (R)
-- REGIONS (R)
+- REGION
+- REGIONS
- RELEASE (R)
- RELOAD
- REMOVE
@@ -549,6 +558,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- REPLICATION
- REQUIRE (R)
- REQUIRED
+- RESET
- RESOURCE
- RESPECT
- RESTART
@@ -570,14 +580,17 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- ROW_NUMBER (R-Window)
- ROWS (R-Window)
- RTREE
+- RUN
S
-- SAMPLES (R)
+- SAMPLERATE
+- SAMPLES
- SAN
- SAVEPOINT
- SECOND
- SECOND_MICROSECOND (R)
+- SECONDARY
- SECONDARY_ENGINE
- SECONDARY_LOAD
- SECONDARY_UNLOAD
@@ -589,6 +602,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- SERIAL
- SERIALIZABLE
- SESSION
+- SESSION_STATES
- SET (R)
- SETVAL
- SHARD_ROW_ID_BITS
@@ -607,7 +621,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- SOME
- SOURCE
- SPATIAL (R)
-- SPLIT (R)
+- SPLIT
- SQL (R)
- SQL_BIG_RESULT (R)
- SQL_BUFFER_RESULT
@@ -629,19 +643,22 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- SSL (R)
- START
- STARTING (R)
-- STATS (R)
+- STATISTICS
+- STATS
- STATS_AUTO_RECALC
-- STATS_BUCKETS (R)
+- STATS_BUCKETS
- STATS_COL_CHOICE
- STATS_COL_LIST
- STATS_EXTENDED (R)
-- STATS_HEALTHY (R)
-- STATS_HISTOGRAMS (R)
-- STATS_META (R)
+- STATS_HEALTHY
+- STATS_HISTOGRAMS
+- STATS_LOCKED
+- STATS_META
- STATS_OPTIONS
- STATS_PERSISTENT
- STATS_SAMPLE_PAGES
- STATS_SAMPLE_RATE
+- STATS_TOPN
- STATUS
- STORAGE
- STORED (R)
@@ -663,15 +680,17 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- TABLESAMPLE (R)
- TABLESPACE
- TABLE_CHECKSUM
+- TELEMETRY
+- TELEMETRY_ID
- TEMPORARY
- TEMPTABLE
- TERMINATED (R)
- TEXT
- THAN
- THEN (R)
-- TIDB (R)
+- TIDB
- TiDB_CURRENT_TSO (R)
-- TIFLASH (R)
+- TIFLASH
- TIKV_IMPORTER
- TIME
- TIMESTAMP
@@ -680,7 +699,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- TINYTEXT (R)
- TO (R)
- TOKEN_ISSUER
-- TOPN (R)
+- TOPN
- TPCC
- TRACE
- TRADITIONAL
@@ -690,6 +709,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- TRIGGERS
- TRUE (R)
- TRUNCATE
+- TSO
- TTL
- TTL_ENABLE
- TTL_JOB_INTERVAL
@@ -739,7 +759,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- WHEN (R)
- WHERE (R)
- WHILE (R)
-- WIDTH (R)
+- WIDTH
- WINDOW (R-Window)
- WITH (R)
- WITHOUT
diff --git a/scripts/check-keywords.sh b/scripts/check-keywords.sh
index c3ee221d5f335..08734d6cd1cf9 100755
--- a/scripts/check-keywords.sh
+++ b/scripts/check-keywords.sh
@@ -16,33 +16,45 @@ keywords = kwdocs.read_text()
errors = 0
section = "Unknown"
for line in parser.read_text().split("\n"):
- if line.find("The following tokens belong to ReservedKeyword") >= 0:
+ if line == "":
+ section = "NotKeywordToken"
+
+ elif line.find("The following tokens belong to ReservedKeyword") >= 0:
section = "ReservedKeyword"
- if line.find("The following tokens belong to UnReservedKeyword") >= 0:
+ elif line.find("The following tokens belong to UnReservedKeyword") >= 0:
section = "UnReservedKeyword"
- if line.find("The following tokens belong to NotKeywordToken") >= 0:
+ elif line.find("The following tokens belong to TiDBKeyword") >= 0:
+ section = "TiDBKeyword"
+
+ elif line.find("The following tokens belong to NotKeywordToken") >= 0:
section = "NotKeywordToken"
if section == "ReservedKeyword":
if m := re.match(r'^\t\w+\s+"(\w+)"$', line):
kw = m.groups()[0]
if not (
- kwm := re.search(f"^- {kw} \((R|R-Window)\)$", keywords, re.MULTILINE)
+ kwm := re.search(f"^- {kw} \\((R|R-Window)\\)$", keywords, re.MULTILINE)
):
if kwm := re.search(f"^- {kw}$", keywords, re.MULTILINE):
- print(f"Keyword not labeled as reserved: {kw}")
- errors += 1
+ print(f"Reserved keyword not labeled as reserved: {kw}")
else:
print(f"Missing docs for reserved keyword: {kw}")
- errors += 1
+ errors += 1
- if section == "UnReservedKeyword":
+ if section in ["UnReservedKeyword", "TiDBKeyword"]:
if m := re.match(r'^\t\w+\s+"(\w+)"$', line):
kw = m.groups()[0]
if not (kwm := re.search(f"^- {kw}$", keywords, re.MULTILINE)):
- print(f"Missing docs for non-reserved keyword: {kw}")
+ if kwm := re.search(
+ f"^- {kw} \\((R|R-Window)\\)$", keywords, re.MULTILINE
+ ):
+ print(
+ f"Non-reserved keyword from {section} labeled as reserved: {kw}"
+ )
+ else:
+ print(f"Missing docs for non-reserved keyword from {section}: {kw}")
errors += 1
sys.exit(errors)