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

Add I_S.keywords for v7.5 #18155

Merged
merged 10 commits into from
Aug 5, 2024
1 change: 1 addition & 0 deletions TOC-tidb-cloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion develop/dev-guide-choose-driver-or-orm.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down
48 changes: 48 additions & 0 deletions information-schema/information-schema-keywords.md
Original file line number Diff line number Diff line change
@@ -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)
```
2 changes: 2 additions & 0 deletions information-schema/information-schema.md
qiancai marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
Expand Down Expand Up @@ -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. |
Expand Down
2 changes: 2 additions & 0 deletions keywords.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)`.
Expand Down
Loading