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) diff --git a/develop/dev-guide-choose-driver-or-orm.md b/develop/dev-guide-choose-driver-or-orm.md index 70d321e21f40f..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.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`](/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). 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..3a7e20fdd3d0d 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. | @@ -69,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. | 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)`.