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
Next Next commit
Add I_S.keywords for v7.5
dveeden committed Jul 9, 2024
commit 239c0bf2c0b80bb6f956c322012ce966c775a536
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)
```
1 change: 1 addition & 0 deletions information-schema/information-schema.md
Original file line number Diff line number Diff line change
@@ -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. |