From 7e064a3e31cf2297b25bf34ae6b38d0a350f75af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Tue, 19 Dec 2023 13:55:50 +0100 Subject: [PATCH 01/13] Add docs for keyword table --- .../information-schema-keywords.md | 43 +++++++++++++++++++ information-schema/information-schema.md | 1 + keywords.md | 2 + 3 files changed, 46 insertions(+) create mode 100644 information-schema/information-schema-keywords.md diff --git a/information-schema/information-schema-keywords.md b/information-schema/information-schema-keywords.md new file mode 100644 index 0000000000000..0c7d9c60630ae --- /dev/null +++ b/information-schema/information-schema-keywords.md @@ -0,0 +1,43 @@ +--- +title: KEYWORDS +summary: Learn the `KEYWORDS` INFORMATION_SCHEMA table. +--- + +# KEYWORDS + +The `KEYWORDS` table provides information about [keywords](/keywords.md). + +```sql +USE INFORMATION_SCHEMA; +DESC keywords; +``` + +The output is as follows: + +``` ++----------+--------------+------+------+---------+-------+ +| Field | Type | Null | Key | Default | Extra | ++----------+--------------+------+------+---------+-------+ +| WORD | varchar(128) | YES | | NULL | | +| RESERVED | int(11) | YES | | NULL | | ++----------+--------------+------+------+---------+-------+ +2 rows in set (0.00 sec) +``` + +An example: +```sql +SELECT * FROM keywords +WHERE WORD IN ('ADD','USER') +``` + +``` ++------+----------+ +| WORD | RESERVED | ++------+----------+ +| ADD | 1 | +| USER | 0 | ++------+----------+ +2 rows in set (0.00 sec) +``` + +Here you can see that `ADD` is a reserved keyword and `USER` is a non-reserved keyword. \ No newline at end of file diff --git a/information-schema/information-schema.md b/information-schema/information-schema.md index 4994d48ba4319..f5a2a0c151680 100644 --- a/information-schema/information-schema.md +++ b/information-schema/information-schema.md @@ -28,6 +28,7 @@ Many `INFORMATION_SCHEMA` tables have a corresponding `SHOW` command. The benefi | `FILES` | Not implemented by TiDB. Returns zero rows. | | `GLOBAL_STATUS` | Not implemented by TiDB. Returns zero rows. | | `GLOBAL_VARIABLES` | Not implemented by TiDB. Returns zero rows. | +| [`KEYWORD`](/information-schema/information-schema-keyword.md) | Provides a list of keywords. | | [`KEY_COLUMN_USAGE`](/information-schema/information-schema-key-column-usage.md) | Describes the key constraints of the columns, such as the primary key constraint. | | `OPTIMIZER_TRACE` | Not implemented by TiDB. Returns zero rows. | | `PARAMETERS` | Not implemented by TiDB. Returns zero rows. | diff --git a/keywords.md b/keywords.md index 3f3fd9886ac20..f3c0dd833d2ee 100644 --- a/keywords.md +++ b/keywords.md @@ -56,6 +56,8 @@ CREATE TABLE test.select (BEGIN int, END int); Query OK, 0 rows affected (0.08 sec) ``` +TiDB provides a list of keywords in the [`information_schema.KEYWORDS`](/information-schema/information-schema-keywords.md) table. + ## Keyword list The following list shows the keywords in TiDB. Reserved keywords are marked with `(R)`. Reserved keywords for [Window Functions](/functions-and-operators/window-functions.md) are marked with `(R-Window)`. Special non-reserved keywords that need to be escaped with backticks `` ` `` are marked with `(S)`. From 7fab91bd53f47e1fa6d91077fdf2a6c13bbbb4cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Wed, 20 Dec 2023 08:11:32 +0000 Subject: [PATCH 02/13] Fix lint issue --- information-schema/information-schema-keywords.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/information-schema/information-schema-keywords.md b/information-schema/information-schema-keywords.md index 0c7d9c60630ae..6629a143330ba 100644 --- a/information-schema/information-schema-keywords.md +++ b/information-schema/information-schema-keywords.md @@ -25,6 +25,7 @@ The output is as follows: ``` An example: + ```sql SELECT * FROM keywords WHERE WORD IN ('ADD','USER') @@ -40,4 +41,4 @@ WHERE WORD IN ('ADD','USER') 2 rows in set (0.00 sec) ``` -Here you can see that `ADD` is a reserved keyword and `USER` is a non-reserved keyword. \ No newline at end of file +Here you can see that `ADD` is a reserved keyword and `USER` is a non-reserved keyword. From 3748bb399dd5c37d2d36f085d79c6faa42d7e31d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Wed, 20 Dec 2023 08:13:39 +0000 Subject: [PATCH 03/13] Add to TOC --- TOC-tidb-cloud.md | 1 + TOC.md | 1 + 2 files changed, 2 insertions(+) diff --git a/TOC-tidb-cloud.md b/TOC-tidb-cloud.md index c3b69b7a58aac..5fcd7dbac6dae 100644 --- a/TOC-tidb-cloud.md +++ b/TOC-tidb-cloud.md @@ -543,6 +543,7 @@ - [`DDL_JOBS`](/information-schema/information-schema-ddl-jobs.md) - [`DEADLOCKS`](/information-schema/information-schema-deadlocks.md) - [`ENGINES`](/information-schema/information-schema-engines.md) + - [`KEYWORD`](/information-schema/information-schema-keyword.md) - [`KEY_COLUMN_USAGE`](/information-schema/information-schema-key-column-usage.md) - [`MEMORY_USAGE`](/information-schema/information-schema-memory-usage.md) - [`MEMORY_USAGE_OPS_HISTORY`](/information-schema/information-schema-memory-usage-ops-history.md) diff --git a/TOC.md b/TOC.md index 671f3117e9fba..f4cfeddfffb79 100644 --- a/TOC.md +++ b/TOC.md @@ -927,6 +927,7 @@ - [`INSPECTION_RESULT`](/information-schema/information-schema-inspection-result.md) - [`INSPECTION_RULES`](/information-schema/information-schema-inspection-rules.md) - [`INSPECTION_SUMMARY`](/information-schema/information-schema-inspection-summary.md) + - [`KEYWORD`](/information-schema/information-schema-keyword.md) - [`KEY_COLUMN_USAGE`](/information-schema/information-schema-key-column-usage.md) - [`MEMORY_USAGE`](/information-schema/information-schema-memory-usage.md) - [`MEMORY_USAGE_OPS_HISTORY`](/information-schema/information-schema-memory-usage-ops-history.md) From f0e1ea4f4787a9ff28bc017db783fe48eefbce0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Wed, 20 Dec 2023 08:16:23 +0000 Subject: [PATCH 04/13] Small corrections --- TOC-tidb-cloud.md | 2 +- TOC.md | 2 +- information-schema/information-schema.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/TOC-tidb-cloud.md b/TOC-tidb-cloud.md index 5fcd7dbac6dae..70609d8455afe 100644 --- a/TOC-tidb-cloud.md +++ b/TOC-tidb-cloud.md @@ -543,7 +543,7 @@ - [`DDL_JOBS`](/information-schema/information-schema-ddl-jobs.md) - [`DEADLOCKS`](/information-schema/information-schema-deadlocks.md) - [`ENGINES`](/information-schema/information-schema-engines.md) - - [`KEYWORD`](/information-schema/information-schema-keyword.md) + - [`KEYWORDS`](/information-schema/information-schema-keywords.md) - [`KEY_COLUMN_USAGE`](/information-schema/information-schema-key-column-usage.md) - [`MEMORY_USAGE`](/information-schema/information-schema-memory-usage.md) - [`MEMORY_USAGE_OPS_HISTORY`](/information-schema/information-schema-memory-usage-ops-history.md) diff --git a/TOC.md b/TOC.md index f4cfeddfffb79..269eabe06c9b8 100644 --- a/TOC.md +++ b/TOC.md @@ -927,7 +927,7 @@ - [`INSPECTION_RESULT`](/information-schema/information-schema-inspection-result.md) - [`INSPECTION_RULES`](/information-schema/information-schema-inspection-rules.md) - [`INSPECTION_SUMMARY`](/information-schema/information-schema-inspection-summary.md) - - [`KEYWORD`](/information-schema/information-schema-keyword.md) + - [`KEYWORDS`](/information-schema/information-schema-keywords.md) - [`KEY_COLUMN_USAGE`](/information-schema/information-schema-key-column-usage.md) - [`MEMORY_USAGE`](/information-schema/information-schema-memory-usage.md) - [`MEMORY_USAGE_OPS_HISTORY`](/information-schema/information-schema-memory-usage-ops-history.md) diff --git a/information-schema/information-schema.md b/information-schema/information-schema.md index f5a2a0c151680..bfda297b48786 100644 --- a/information-schema/information-schema.md +++ b/information-schema/information-schema.md @@ -28,7 +28,7 @@ Many `INFORMATION_SCHEMA` tables have a corresponding `SHOW` command. The benefi | `FILES` | Not implemented by TiDB. Returns zero rows. | | `GLOBAL_STATUS` | Not implemented by TiDB. Returns zero rows. | | `GLOBAL_VARIABLES` | Not implemented by TiDB. Returns zero rows. | -| [`KEYWORD`](/information-schema/information-schema-keyword.md) | Provides a list of keywords. | +| [`KEYWORDS`](/information-schema/information-schema-keywords.md) | Provides a list of keywords. | | [`KEY_COLUMN_USAGE`](/information-schema/information-schema-key-column-usage.md) | Describes the key constraints of the columns, such as the primary key constraint. | | `OPTIMIZER_TRACE` | Not implemented by TiDB. Returns zero rows. | | `PARAMETERS` | Not implemented by TiDB. Returns zero rows. | From 469b13792aaf2ef20d10803dfa2181a3383a10d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Wed, 20 Dec 2023 09:19:45 +0100 Subject: [PATCH 05/13] Update information-schema/information-schema-keywords.md Co-authored-by: Aolin --- information-schema/information-schema-keywords.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/information-schema/information-schema-keywords.md b/information-schema/information-schema-keywords.md index 6629a143330ba..8978eb7b178e8 100644 --- a/information-schema/information-schema-keywords.md +++ b/information-schema/information-schema-keywords.md @@ -24,7 +24,7 @@ The output is as follows: 2 rows in set (0.00 sec) ``` -An example: +The following statement queries the information about `ADD` and `USER` keywords: ```sql SELECT * FROM keywords From 97243e878eb7666321ea01539fdd1984d89cdf5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Wed, 20 Dec 2023 09:20:02 +0100 Subject: [PATCH 06/13] Update information-schema/information-schema-keywords.md Co-authored-by: Aolin --- information-schema/information-schema-keywords.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/information-schema/information-schema-keywords.md b/information-schema/information-schema-keywords.md index 8978eb7b178e8..559aab61b9562 100644 --- a/information-schema/information-schema-keywords.md +++ b/information-schema/information-schema-keywords.md @@ -31,6 +31,8 @@ SELECT * FROM keywords WHERE WORD IN ('ADD','USER') ``` +From the output, you can see that `ADD` is a reserved keyword and `USER` is a non-reserved keyword. + ``` +------+----------+ | WORD | RESERVED | From 91850a2b8f8290820367dc961d236f1b4c46d1fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Wed, 20 Dec 2023 09:20:12 +0100 Subject: [PATCH 07/13] Update keywords.md Co-authored-by: Aolin --- keywords.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keywords.md b/keywords.md index f3c0dd833d2ee..be3feade7167a 100644 --- a/keywords.md +++ b/keywords.md @@ -56,7 +56,7 @@ CREATE TABLE test.select (BEGIN int, END int); Query OK, 0 rows affected (0.08 sec) ``` -TiDB provides a list of keywords in the [`information_schema.KEYWORDS`](/information-schema/information-schema-keywords.md) table. +TiDB provides a list of keywords in the [`INFORMATION_SCHEMA.KEYWORDS`](/information-schema/information-schema-keywords.md) table. ## Keyword list From eb57f4c0c15e01a6ac32509e73e3cf56aa4697de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Wed, 20 Dec 2023 09:20:21 +0100 Subject: [PATCH 08/13] Update information-schema/information-schema-keywords.md Co-authored-by: Aolin --- information-schema/information-schema-keywords.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/information-schema/information-schema-keywords.md b/information-schema/information-schema-keywords.md index 559aab61b9562..fc446ec2c0a0f 100644 --- a/information-schema/information-schema-keywords.md +++ b/information-schema/information-schema-keywords.md @@ -42,5 +42,3 @@ From the output, you can see that `ADD` is a reserved keyword and `USER` is a no +------+----------+ 2 rows in set (0.00 sec) ``` - -Here you can see that `ADD` is a reserved keyword and `USER` is a non-reserved keyword. From 9ff86fd7fa2859e49987d95eb1b18bfac8617bbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Wed, 20 Dec 2023 09:20:42 +0100 Subject: [PATCH 09/13] Update information-schema/information-schema-keywords.md Co-authored-by: Aolin --- information-schema/information-schema-keywords.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/information-schema/information-schema-keywords.md b/information-schema/information-schema-keywords.md index fc446ec2c0a0f..48dd11b775696 100644 --- a/information-schema/information-schema-keywords.md +++ b/information-schema/information-schema-keywords.md @@ -27,8 +27,7 @@ The output is as follows: The following statement queries the information about `ADD` and `USER` keywords: ```sql -SELECT * FROM keywords -WHERE WORD IN ('ADD','USER') +SELECT * FROM keywords WHERE WORD IN ('ADD','USER'); ``` From the output, you can see that `ADD` is a reserved keyword and `USER` is a non-reserved keyword. From 8b5a2db6ca45b6d555377e6d09da6179254e8e85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Wed, 20 Dec 2023 09:45:11 +0100 Subject: [PATCH 10/13] Update information-schema/information-schema-keywords.md Co-authored-by: Aolin --- information-schema/information-schema-keywords.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/information-schema/information-schema-keywords.md b/information-schema/information-schema-keywords.md index 48dd11b775696..f523f57c9d3bd 100644 --- a/information-schema/information-schema-keywords.md +++ b/information-schema/information-schema-keywords.md @@ -5,7 +5,7 @@ summary: Learn the `KEYWORDS` INFORMATION_SCHEMA table. # KEYWORDS -The `KEYWORDS` table provides information about [keywords](/keywords.md). +Starting from v7.6.0, TiDB provides the `KEYWORDS` table. You can use this table to get information about [keywords](/keywords.md). ```sql USE INFORMATION_SCHEMA; From 7053a97221d25cbc21a6a71aaa69e9f79ac7dfe9 Mon Sep 17 00:00:00 2001 From: Aolin Date: Wed, 20 Dec 2023 16:50:39 +0800 Subject: [PATCH 11/13] Apply suggestions from code review --- keywords.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keywords.md b/keywords.md index be3feade7167a..e460314441e10 100644 --- a/keywords.md +++ b/keywords.md @@ -56,7 +56,7 @@ CREATE TABLE test.select (BEGIN int, END int); Query OK, 0 rows affected (0.08 sec) ``` -TiDB provides a list of keywords in the [`INFORMATION_SCHEMA.KEYWORDS`](/information-schema/information-schema-keywords.md) table. +Starting from v7.6.0, TiDB provides a list of keywords in the [`INFORMATION_SCHEMA.KEYWORDS`](/information-schema/information-schema-keywords.md) table. ## Keyword list From ff9ad8da9545b3c376c85d1d790d0d64b6f45261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Thu, 21 Dec 2023 08:26:14 +0100 Subject: [PATCH 12/13] Apply suggestions from code review Co-authored-by: Grace Cai --- information-schema/information-schema-keywords.md | 8 ++++++-- information-schema/information-schema.md | 2 +- keywords.md | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/information-schema/information-schema-keywords.md b/information-schema/information-schema-keywords.md index f523f57c9d3bd..2a398f2729d1e 100644 --- a/information-schema/information-schema-keywords.md +++ b/information-schema/information-schema-keywords.md @@ -5,7 +5,7 @@ summary: Learn the `KEYWORDS` INFORMATION_SCHEMA table. # KEYWORDS -Starting from v7.6.0, TiDB provides the `KEYWORDS` table. You can use this table to get information about [keywords](/keywords.md). +Starting from v7.6.0, TiDB provides the `KEYWORDS` table. You can use this table to get information about [keywords](/keywords.md) in TiDB. ```sql USE INFORMATION_SCHEMA; @@ -23,11 +23,15 @@ The output is as follows: +----------+--------------+------+------+---------+-------+ 2 rows in set (0.00 sec) ``` +Field description: + +- `WORD`: The keyword. +- `RESERVED`: Whether the keyword is reserved. The following statement queries the information about `ADD` and `USER` keywords: ```sql -SELECT * FROM keywords WHERE WORD IN ('ADD','USER'); +SELECT * FROM INFORMATION_SCHEMA.KEYWORDS WHERE WORD IN ('ADD','USER'); ``` From the output, you can see that `ADD` is a reserved keyword and `USER` is a non-reserved keyword. diff --git a/information-schema/information-schema.md b/information-schema/information-schema.md index bfda297b48786..9afd5684c5624 100644 --- a/information-schema/information-schema.md +++ b/information-schema/information-schema.md @@ -28,7 +28,7 @@ Many `INFORMATION_SCHEMA` tables have a corresponding `SHOW` command. The benefi | `FILES` | Not implemented by TiDB. Returns zero rows. | | `GLOBAL_STATUS` | Not implemented by TiDB. Returns zero rows. | | `GLOBAL_VARIABLES` | Not implemented by TiDB. Returns zero rows. | -| [`KEYWORDS`](/information-schema/information-schema-keywords.md) | Provides a list of keywords. | +| [`KEYWORDS`](/information-schema/information-schema-keywords.md) | Provides a full list of keywords. | | [`KEY_COLUMN_USAGE`](/information-schema/information-schema-key-column-usage.md) | Describes the key constraints of the columns, such as the primary key constraint. | | `OPTIMIZER_TRACE` | Not implemented by TiDB. Returns zero rows. | | `PARAMETERS` | Not implemented by TiDB. Returns zero rows. | diff --git a/keywords.md b/keywords.md index e460314441e10..29bf539dbb565 100644 --- a/keywords.md +++ b/keywords.md @@ -56,7 +56,7 @@ CREATE TABLE test.select (BEGIN int, END int); Query OK, 0 rows affected (0.08 sec) ``` -Starting from v7.6.0, TiDB provides a list of keywords in the [`INFORMATION_SCHEMA.KEYWORDS`](/information-schema/information-schema-keywords.md) table. +Starting from v7.6.0, TiDB provides a full list of keywords in the [`INFORMATION_SCHEMA.KEYWORDS`](/information-schema/information-schema-keywords.md) table. ## Keyword list From f6684cd892f31c44f63a6b1f95c0211f12822abc Mon Sep 17 00:00:00 2001 From: Aolin Date: Thu, 21 Dec 2023 16:22:06 +0800 Subject: [PATCH 13/13] make ci happy --- information-schema/information-schema-keywords.md | 1 + 1 file changed, 1 insertion(+) diff --git a/information-schema/information-schema-keywords.md b/information-schema/information-schema-keywords.md index 2a398f2729d1e..1c2668b2275bf 100644 --- a/information-schema/information-schema-keywords.md +++ b/information-schema/information-schema-keywords.md @@ -23,6 +23,7 @@ The output is as follows: +----------+--------------+------+------+---------+-------+ 2 rows in set (0.00 sec) ``` + Field description: - `WORD`: The keyword.