From 239c0bf2c0b80bb6f956c322012ce966c775a536 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Tue, 9 Jul 2024 11:48:59 +0200 Subject: [PATCH 1/8] Add I_S.keywords for v7.5 --- .../information-schema-keywords.md | 48 +++++++++++++++++++ information-schema/information-schema.md | 1 + 2 files changed, 49 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..b3d4daa733829 --- /dev/null +++ b/information-schema/information-schema-keywords.md @@ -0,0 +1,48 @@ +--- +title: KEYWORDS +summary: Learn the `KEYWORDS` INFORMATION_SCHEMA table. +--- + +# KEYWORDS + +Starting from v7.5.3, TiDB provides the `KEYWORDS` table. You can use this table to get information about [keywords](/keywords.md) in TiDB. + +```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) +``` + +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 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. + +``` ++------+----------+ +| WORD | RESERVED | ++------+----------+ +| ADD | 1 | +| USER | 0 | ++------+----------+ +2 rows in set (0.00 sec) +``` diff --git a/information-schema/information-schema.md b/information-schema/information-schema.md index 791c88c136ad1..03d5561788971 100644 --- a/information-schema/information-schema.md +++ b/information-schema/information-schema.md @@ -27,6 +27,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 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. | From 7ad21af1b095efa90bda388035bc797ee1a43518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Tue, 9 Jul 2024 11:57:34 +0200 Subject: [PATCH 2/8] Add reference to keywords.md --- keywords.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/keywords.md b/keywords.md index 0e38131f6d745..1b09cedfa5281 100644 --- a/keywords.md +++ b/keywords.md @@ -55,6 +55,8 @@ CREATE TABLE test.select (BEGIN int, END int); Query OK, 0 rows affected (0.08 sec) ``` +Starting from v7.5.3, TiDB provides a full 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 bdbdaa700c0a721cbcc0b9e3f2ac8b88c26a6392 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Wed, 10 Jul 2024 08:51:18 +0200 Subject: [PATCH 3/8] 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 50c7730b4af94..80a231cccca9f 100644 --- a/TOC-tidb-cloud.md +++ b/TOC-tidb-cloud.md @@ -617,6 +617,7 @@ - [`DDL_JOBS`](/information-schema/information-schema-ddl-jobs.md) - [`DEADLOCKS`](/information-schema/information-schema-deadlocks.md) - [`ENGINES`](/information-schema/information-schema-engines.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 45a320ecd0c01..fa448d6465960 100644 --- a/TOC.md +++ b/TOC.md @@ -935,6 +935,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) + - [`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) From b4d9c262c74bdc8f52f02c16f36c9c0649d66acf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Wed, 10 Jul 2024 08:51:38 +0200 Subject: [PATCH 4/8] Update information-schema/information-schema.md Co-authored-by: Aolin --- information-schema/information-schema.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/information-schema/information-schema.md b/information-schema/information-schema.md index 03d5561788971..b9a129092d357 100644 --- a/information-schema/information-schema.md +++ b/information-schema/information-schema.md @@ -27,7 +27,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 full 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. | From bea8cda6a3b428469a166d3ed7e49c15fb2c3353 Mon Sep 17 00:00:00 2001 From: Aolin Date: Wed, 10 Jul 2024 15:07:41 +0800 Subject: [PATCH 5/8] update Connector/J 8.0 compatibility --- develop/dev-guide-choose-driver-or-orm.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/develop/dev-guide-choose-driver-or-orm.md b/develop/dev-guide-choose-driver-or-orm.md index 70d321e21f40f..e53f4eba3ef6c 100644 --- a/develop/dev-guide-choose-driver-or-orm.md +++ b/develop/dev-guide-choose-driver-or-orm.md @@ -32,7 +32,7 @@ You can follow the [MySQL documentation](https://dev.mysql.com/doc/connector-j/e > **Note:** > > - There is a [bug](https://bugs.mysql.com/bug.php?id=106252) in the Connector/J 8.0 versions before 8.0.32, which might cause threads to hang when using TiDB versions earlier than v6.3.0. To avoid this issue, it is recommended that you use either MySQL Connector/J 8.0.32 or a later version, or the TiDB JDBC (see the *TiDB-JDBC* tab). -> - When you are using MySQL Connector/J 8.0 with TiDB v7.5.x, it is recommended to set the TiDB configuration item [`server-version`](https://docs.pingcap.com/tidb/v7.5/tidb-configuration-file#server-version) to `"5.7.25-TiDB-v7.5.x"`. MySQL Connector/J attempts to access the `information_schema.KEYWORDS` table if the TiDB server reports a version of MySQL 8.0.11 or later. However, this table is not present in TiDB v7.5.x. +> - When you are using MySQL Connector/J 8.0 with TiDB v7.5.2 or earlier versions, it is recommended to set the TiDB configuration item [`server-version`](https://docs.pingcap.com/tidb/v7.5/tidb-configuration-file#server-version) to `"5.7.25-TiDB-v7.5.x"`. MySQL Connector/J attempts to access the `information_schema.KEYWORDS` table if the TiDB server reports a version of MySQL 8.0.11 or later. However, TiDB provides this table in v7.5.3. For an example of how to build a complete application, see [Build a simple CRUD app with TiDB and JDBC](/develop/dev-guide-sample-application-java-jdbc.md). From 7e9268da59e5107ee4c2082233ada46152843103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Wed, 10 Jul 2024 09:13:56 +0200 Subject: [PATCH 6/8] Update develop/dev-guide-choose-driver-or-orm.md --- develop/dev-guide-choose-driver-or-orm.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/develop/dev-guide-choose-driver-or-orm.md b/develop/dev-guide-choose-driver-or-orm.md index e53f4eba3ef6c..1db4f06c02ea9 100644 --- a/develop/dev-guide-choose-driver-or-orm.md +++ b/develop/dev-guide-choose-driver-or-orm.md @@ -32,7 +32,7 @@ You can follow the [MySQL documentation](https://dev.mysql.com/doc/connector-j/e > **Note:** > > - There is a [bug](https://bugs.mysql.com/bug.php?id=106252) in the Connector/J 8.0 versions before 8.0.32, which might cause threads to hang when using TiDB versions earlier than v6.3.0. To avoid this issue, it is recommended that you use either MySQL Connector/J 8.0.32 or a later version, or the TiDB JDBC (see the *TiDB-JDBC* tab). -> - When you are using MySQL Connector/J 8.0 with TiDB v7.5.2 or earlier versions, it is recommended to set the TiDB configuration item [`server-version`](https://docs.pingcap.com/tidb/v7.5/tidb-configuration-file#server-version) to `"5.7.25-TiDB-v7.5.x"`. MySQL Connector/J attempts to access the `information_schema.KEYWORDS` table if the TiDB server reports a version of MySQL 8.0.11 or later. However, TiDB provides this table in v7.5.3. +> - When you are using MySQL Connector/J 8.0 with TiDB v7.5.2 or earlier versions, it is recommended to set the TiDB configuration item [`server-version`](https://docs.pingcap.com/tidb/v7.5/tidb-configuration-file#server-version) to `"5.7.25-TiDB-v7.5.x"`. MySQL Connector/J attempts to access the [`information_schema.KEYWORDS`](/information-schema/information-schema-keywords.md) table if the TiDB server reports a version of MySQL 8.0.11 or later. However, TiDB provides this table in v7.5.3. For an example of how to build a complete application, see [Build a simple CRUD app with TiDB and JDBC](/develop/dev-guide-sample-application-java-jdbc.md). From d7d16c7fa61dccdb0088485fca156d50fc70d36e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Thu, 11 Jul 2024 09:02:21 +0200 Subject: [PATCH 7/8] Update develop/dev-guide-choose-driver-or-orm.md Co-authored-by: Grace Cai --- develop/dev-guide-choose-driver-or-orm.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/develop/dev-guide-choose-driver-or-orm.md b/develop/dev-guide-choose-driver-or-orm.md index 1db4f06c02ea9..1430c847f2b1a 100644 --- a/develop/dev-guide-choose-driver-or-orm.md +++ b/develop/dev-guide-choose-driver-or-orm.md @@ -32,7 +32,7 @@ You can follow the [MySQL documentation](https://dev.mysql.com/doc/connector-j/e > **Note:** > > - There is a [bug](https://bugs.mysql.com/bug.php?id=106252) in the Connector/J 8.0 versions before 8.0.32, which might cause threads to hang when using TiDB versions earlier than v6.3.0. To avoid this issue, it is recommended that you use either MySQL Connector/J 8.0.32 or a later version, or the TiDB JDBC (see the *TiDB-JDBC* tab). -> - When you are using MySQL Connector/J 8.0 with TiDB v7.5.2 or earlier versions, it is recommended to set the TiDB configuration item [`server-version`](https://docs.pingcap.com/tidb/v7.5/tidb-configuration-file#server-version) to `"5.7.25-TiDB-v7.5.x"`. MySQL Connector/J attempts to access the [`information_schema.KEYWORDS`](/information-schema/information-schema-keywords.md) table if the TiDB server reports a version of MySQL 8.0.11 or later. However, TiDB provides this table in v7.5.3. +> - When you are using MySQL Connector/J 8.0 with TiDB v7.5.2 or earlier versions, it is recommended to set the TiDB configuration item [`server-version`](https://docs.pingcap.com/tidb/v7.5/tidb-configuration-file#server-version) to `"5.7.25-TiDB-v7.5.x"`. MySQL Connector/J attempts to access the [`information_schema.KEYWORDS`](/information-schema/information-schema-keywords.md) table if the TiDB server reports a version of MySQL 8.0.11 or later. However, this table is introduced starting from v7.5.3 and is not present in earlier versions. For an example of how to build a complete application, see [Build a simple CRUD app with TiDB and JDBC](/develop/dev-guide-sample-application-java-jdbc.md). From c13d1aa9c47b36f5fcb19d87541bddfcf53f6598 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Thu, 11 Jul 2024 09:27:37 +0200 Subject: [PATCH 8/8] Add KEYWORDS for Cloud --- information-schema/information-schema.md | 1 + 1 file changed, 1 insertion(+) diff --git a/information-schema/information-schema.md b/information-schema/information-schema.md index b9a129092d357..3a7e20fdd3d0d 100644 --- a/information-schema/information-schema.md +++ b/information-schema/information-schema.md @@ -70,6 +70,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 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. |