Skip to content
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
1 change: 1 addition & 0 deletions TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,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 @@ TiDB 兼容 MySQL 的协议,但存在部分与 MySQL 不兼容或有差异的
> **注意:**
>
> - 在 8.0.32 之前的 MySQL Connector/J 8.0 版本中存在一个 [bug](https://bugs.mysql.com/bug.php?id=106252),当与 TiDB v6.3.0 之前的版本一起使用时,可能会导致线程卡死。为了避免此问题,建议使用 MySQL Connector/J 8.0.32 或更高版本,或者使用 TiDB JDBC(见 *TiDB-JDBC* 标签)。
> - MySQL Connector/J 8.0 与 TiDB v7.5.x 一起使用时,建议将 TiDB 配置项 [`server-version`](/tidb-configuration-file.md#server-version) 设置为 `"5.7.25-TiDB-v7.5.x"`。这是因为,当 TiDB 服务器报告版本为 MySQL 8.0.11 或更高版本时,MySQL Connector/J 会尝试访问 TiDB v7.5.x 中不存在的 `information_schema.KEYWORDS`
> - MySQL Connector/J 8.0 与 TiDB v7.5.2 或之前版本一起使用时,建议将 TiDB 配置项 [`server-version`](/tidb-configuration-file.md#server-version) 设置为 `"5.7.25-TiDB-v7.5.x"`。这是因为,当 TiDB 服务器报告版本为 MySQL 8.0.11 或更高版本时,MySQL Connector/J 会尝试访问 TiDB 的 [`information_schema.KEYWORDS`](/information-schema/information-schema-keywords.md) 表,但该表是从 v7.5.3 开始引入的,在 v7.5.2 及之前版本中不存在

有关一个完整的实例应用程序,可参阅 [TiDB 和 JDBC 的简单 CRUD 应用程序](/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: 了解 INFORMATION_SCHEMA 表 `KEYWORDS`。
---

# KEYWORDS

TiDB 从 v7.5.3 开始提供 `KEYWORDS` 表,你可以使用该表查看 TiDB 中[关键字](/keywords.md)的信息。

```sql
USE INFORMATION_SCHEMA;
DESC keywords;
```

输出结果如下:

```
+----------+--------------+------+------+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+------+---------+-------+
| WORD | varchar(128) | YES | | NULL | |
| RESERVED | int(11) | YES | | NULL | |
+----------+--------------+------+------+---------+-------+
2 rows in set (0.00 sec)
```

字段含义如下:

- `WORD`:关键字
- `RESERVED`:关键字是否为保留关键字

例如,你可以使用以下 SQL 语句查询 `ADD` 和 `USER` 关键字的信息:

```sql
SELECT * FROM INFORMATION_SCHEMA.KEYWORDS WHERE WORD IN ('ADD','USER');
```

输出结果显示 `ADD` 是一个保留关键字,`USER` 是一个非保留关键字。

```
+------+----------+
| WORD | RESERVED |
+------+----------+
| ADD | 1 |
| USER | 0 |
+------+----------+
2 rows in set (0.00 sec)
```
1 change: 1 addition & 0 deletions information-schema/information-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Information Schema 提供了一种查看系统元数据的 ANSI 标准方法。
| `FILES` | TiDB 未实现,返回零行。 |
| `GLOBAL_STATUS` | TiDB 未实现,返回零行。 |
| `GLOBAL_VARIABLES` | TiDB 未实现,返回零行。 |
| [`KEYWORDS`](/information-schema/information-schema-keywords.md) | 提供关键字列表。 |
| [`KEY_COLUMN_USAGE`](/information-schema/information-schema-key-column-usage.md) | 描述列的键约束,例如主键约束。 |
| `OPTIMIZER_TRACE` | TiDB 未实现,返回零行。 |
| `PARAMETERS` | TiDB 未实现,返回零行。 |
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)
```

TiDB 从 v7.5.3 开始提供 [`INFORMATION_SCHEMA.KEYWORDS`](/information-schema/information-schema-keywords.md) 表,可以用于查询 TiDB 中所有的关键字。

## 关键字列表

下表列出了 TiDB 中所有的关键字。其中保留字用 `(R)` 来标识。[窗口函数](/functions-and-operators/window-functions.md)的保留字用 `(R-Window)` 来标识。需要用反引号 `` ` `` 包裹的特殊非保留字用 `(S)` 来标识。
Expand Down