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

Update Keywords #13253

Merged
merged 2 commits into from
Apr 22, 2023
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
62 changes: 62 additions & 0 deletions keywords.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,12 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- ANALYZE (R)
- AND (R)
- ANY
- ARRAY (R)
- AS (R)
- ASC (R)
- ASCII
- ATTRIBUTE
- ATTRIBUTES
- AUTO_ID_CACHE
- AUTO_INCREMENT
- AUTO_RANDOM
Expand All @@ -95,11 +98,13 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- BACKUP
- BACKUPS
- BEGIN
- BERNOULLI
- BETWEEN (R)
- BIGINT (R)
- BINARY (R)
- BINDING
- BINDINGS
- BINDING_CACHE
- BINLOG
- BIT
- BLOB (R)
Expand All @@ -116,11 +121,14 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
<a id="C" class="letter" href="#C">C</a>

- CACHE
- CALIBRATE
- CALL (R)
- CANCEL (R)
- CAPTURE
- CASCADE (R)
- CASCADED
- CASE (R)
- CAUSAL
- CHAIN
- CHANGE (R)
- CHAR (R)
Expand All @@ -132,6 +140,9 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- CIPHER
- CLEANUP
- CLIENT
- CLIENT_ERRORS_SUMMARY
- CLUSTER
- CLUSTERED
- CMSKETCH (R)
- COALESCE
- COLLATE (R)
Expand All @@ -148,6 +159,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- CONCURRENCY
- CONFIG
- CONNECTION
- CONSISTENCY
- CONSISTENT
- CONSTRAINT (R)
- CONTEXT
Expand Down Expand Up @@ -195,8 +207,10 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- DEPTH (R)
- DESC (R)
- DESCRIBE (R)
- DIGEST
- DIRECTORY
- DISABLE
- DISABLED
- DISCARD
- DISK
- DISTINCT (R)
Expand All @@ -214,6 +228,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with

- ELSE (R)
- ENABLE
- ENABLED
- ENCLOSED (R)
- ENCRYPTION
- END
Expand All @@ -240,8 +255,10 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with

<a id="F" class="letter" href="#F">F</a>

- FAILED_LOGIN_ATTEMPTS
- FALSE (R)
- FAULTS
- FETCH (R)
- FIELDS
- FILE
- FIRST
Expand Down Expand Up @@ -273,7 +290,9 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with

- HASH
- HAVING (R)
- HELP
- HIGH_PRIORITY (R)
- HISTOGRAM
- HISTORY
- HOSTS
- HOUR
Expand All @@ -286,6 +305,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- IDENTIFIED
- IF (R)
- IGNORE (R)
- ILIKE (R)
- IMPORT
- IMPORTS
- IN (R)
Expand All @@ -305,6 +325,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- INT4 (R)
- INT8 (R)
- INTEGER (R)
- INTERSECT (R)
- INTERVAL (R)
- INTO (R)
- INVISIBLE
Expand Down Expand Up @@ -354,6 +375,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- LOCALTIMESTAMP (R)
- LOCATION
- LOCK (R)
- LOCKED
- LOGS
- LONG (R)
- LONGBLOB (R)
Expand All @@ -376,6 +398,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- MEDIUMBLOB (R)
- MEDIUMINT (R)
- MEDIUMTEXT (R)
- MEMBER
- MEMORY
- MERGE
- MICROSECOND
Expand Down Expand Up @@ -406,6 +429,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- NODE_STATE (R)
- NOMAXVALUE
- NOMINVALUE
- NONCLUSTERED
- NONE
- NOT (R)
- NOWAIT
Expand All @@ -419,7 +443,12 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with

<a id="O" class="letter" href="#O">O</a>

- OF (R)
- OFF
- OFFSET
- OLTP_READ_ONLY
- OLTP_READ_WRITE
- OLTP_WRITE_ONLY
- ON (R)
- ONLINE
- ONLY
Expand All @@ -428,6 +457,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- OPTIMISTIC (R)
- OPTIMIZE (R)
- OPTION (R)
- OPTIONAL
- OPTIONALLY (R)
- OR (R)
- ORDER (R)
Expand All @@ -445,15 +475,21 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- PARTITIONING
- PARTITIONS
- PASSWORD
- PASSWORD_LOCK_TIME
- PAUSE
- PERCENT
- PERCENT_RANK (R-Window)
- PER_DB
- PER_TABLE
- PESSIMISTIC (R)
- PLACEMENT (S)
- PLUGINS
- POINT
- POLICY
- PRECEDING
- PRECISION (R)
- PREPARE
- PRESERVE
- PRE_SPLIT_REGIONS
- PRIMARY (R)
- PRIVILEGES
Expand All @@ -462,7 +498,9 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- PROCESSLIST
- PROFILE
- PROFILES
- PROXY
- PUMP (R)
- PURGE

<a id="Q" class="letter" href="#Q">Q</a>

Expand All @@ -480,6 +518,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- REAL (R)
- REBUILD
- RECOVER
- RECURSIVE (R)
- REDUNDANT
- REFERENCES (R)
- REGEXP (R)
Expand All @@ -495,12 +534,18 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- REPEATABLE
- REPLACE (R)
- REPLICA
- REPLICAS
- REPLICATION
- REQUIRE (R)
- REQUIRED
- RESOURCE
- RESPECT
- RESTART
- RESTORE
- RESTORES
- RESTRICT (R)
- RESUME
- REUSE
- REVERSE
- REVOKE (R)
- RIGHT (R)
Expand All @@ -518,6 +563,8 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
<a id="S" class="letter" href="#S">S</a>

- SAMPLES (R)
- SAN
- SAVEPOINT
- SECOND
- SECONDARY_ENGINE
- SECONDARY_LOAD
Expand All @@ -540,6 +587,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- SHUTDOWN
- SIGNED
- SIMPLE
- SKIP
- SKIP_SCHEMA_FILES
- SLAVE
- SLOW
Expand Down Expand Up @@ -570,11 +618,16 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- STATS (R)
- STATS_AUTO_RECALC
- STATS_BUCKETS (R)
- STATS_COL_CHOICE
- STATS_COL_LIST
- STATS_EXTENDED (R)
- STATS_HEALTHY (R)
- STATS_HISTOGRAMS (R)
- STATS_META (R)
- STATS_OPTIONS
- STATS_PERSISTENT
- STATS_SAMPLE_PAGES
- STATS_SAMPLE_RATE
- STATUS
- STORAGE
- STORED (R)
Expand All @@ -586,12 +639,14 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- SUPER
- SWAPS
- SWITCHES
- SYSTEM
- SYSTEM_TIME

<a id="T" class="letter" href="#T">T</a>

- TABLE (R)
- TABLES
- TABLESAMPLE (R)
- TABLESPACE
- TABLE_CHECKSUM
- TEMPORARY
Expand All @@ -611,6 +666,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- TO (R)
- TOKEN_ISSUER
- TOPN (R)
- TPCC
- TRACE
- TRADITIONAL
- TRAILING (R)
Expand All @@ -619,7 +675,11 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- TRIGGERS
- TRUE (R)
- TRUNCATE
- TTL
- TTL_ENABLE
- TTL_JOB_INTERVAL
- TYPE
- TiDB_CURRENT_TSO (R)

<a id="U" class="letter" href="#U">U</a>

Expand Down Expand Up @@ -657,6 +717,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with

<a id="W" class="letter" href="#W">W</a>

- WAIT
- WARNINGS
- WEEK
- WEIGHT_STRING
Expand All @@ -666,6 +727,7 @@ The following list shows the keywords in TiDB. Reserved keywords are marked with
- WINDOW (R-Window)
- WITH (R)
- WITHOUT
- WORKLOAD
- WRITE (R)

<a id="X" class="letter" href="#X">X</a>
Expand Down
48 changes: 48 additions & 0 deletions scripts/check-keywords.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/python3
import re
import sys
from pathlib import Path

parser = Path("../tidb/parser/parser.y")
if not parser.exists():
sys.exit(f"{parser} doesn't exist")

kwdocs = Path("keywords.md")
if not parser.exists():
sys.exit(f"{kwdocs} doesn't exist")

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:
section = "ReservedKeyword"

if line.find("The following tokens belong to UnReservedKeyword") >= 0:
section = "UnReservedKeyword"

if 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)
):
if kwm := re.search(f"^- {kw}$", keywords, re.MULTILINE):
print(f"Keyword not labeled as reserved: {kw}")
errors += 1
else:
print(f"Missing docs for reserved keyword: {kw}")
errors += 1

if section == "UnReservedKeyword":
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}")
errors += 1

sys.exit(errors)