Bug #114874 Five mistakes in information_schema.keywords.reserved in 8.4+
Submitted: 3 May 2024 20:17 Modified: 23 Apr 20:10
Reporter: Evan Elias Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Information schema Severity:S3 (Non-critical)
Version:8.4, 9.4, 9.5, 9.6, 9.7 OS:Any
Assigned to: CPU Architecture:Any

[3 May 2024 20:17] Evan Elias
Description:
In MySQL 8.4.0, four new reserved words were added to the server:

MANUAL
PARALLEL
QUALIFY
TABLESAMPLE

These four are now present in information_schema.keywords, but they incorrectly have reserved=0 when it should be 1.

Additionally, CUBE (a reserved word added in 8.0) is still reserved in 8.4, but information_schema.keywords incorrectly has reserved=0 for it now.

How to repeat:
Querying information_schema to show the incorrect data:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.4.0 MySQL Community Server - GPL

Copyright (c) 2000, 2024, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SELECT * FROM information_schema.keywords where word IN ('cube', 'manual', 'parallel', 'qualify', 'tablesample');
+-------------+----------+
| WORD        | RESERVED |
+-------------+----------+
| CUBE        |        0 |
| MANUAL      |        0 |
| PARALLEL    |        0 |
| QUALIFY     |        0 |
| TABLESAMPLE |        0 |
+-------------+----------+
5 rows in set (0.01 sec)

Proof these are indeed reserved words:

mysql> CREATE TABLE cube (id int);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'cube (id int)' at line 1
mysql> CREATE TABLE manual (id int);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'manual (id int)' at line 1
mysql> CREATE TABLE parallel (id int);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'parallel (id int)' at line 1
mysql> CREATE TABLE qualify (id int);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'qualify (id int)' at line 1
mysql> CREATE TABLE tablesample (id int);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'tablesample(id int)' at line 1

Suggested fix:
Please set reserved=1 for these five rows
[6 May 2024 6:04] MySQL Verification Team
Hello Evan Elias,

Thank you for the report and feedback.

regards,
Umesh
[23 Oct 2025 19:44] Evan Elias
One more problem row in MySQL 9.4+: EXTERNAL is now a reserved word, but information_schema.keywords incorrectly lists it as non-reserved.

mysql> select * from information_schema.keywords where word = 'external';
+----------+----------+
| WORD     | RESERVED |
+----------+----------+
| EXTERNAL |        0 |
+----------+----------+
1 row in set (0.004 sec)

mysql> create table external (id int);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'external (id int)' at line 1
[30 Jan 0:14] Evan Elias
Also SETS which is a new reserved word in MySQL 9.6, but is erroneously listed as non-reserved in information_schema.keywords... this seems to keep happening with new reserved words :(
[27 Mar 11:31] Yakir Gibraltar
ix CUBE/MANUAL/PARALLEL/QUALIFY/TABLESAMPLE wrongly reported as non-reserved in IS.KEYWORDS

Attachment: bug114874.patch (application/octet-stream, text), 3.44 KiB.

[27 Mar 11:32] Yakir Gibraltar
Root cause: all five keywords are declared %token<lexer.keyword> in sql_yacc.yy,
which causes gen_keyword_list.cc to mark them RESERVED=0. But none appear in any
ident_keywords_* rule, so the parser already rejects them as identifiers — they
ARE reserved. The <lexer.keyword> type annotation is simply wrong for reserved words.

Fix: change the five declarations to plain %token (the convention used by SELECT,
FROM, WHERE, etc.). Also added a convention comment to the token declaration block
to prevent recurrence — this same mistake has been made at least 5 times across
different worklogs since 2022 (WL#15843, WL#15902, WL#15864, WL#14717, WL#15786).

Patch attached. Applies to branch 8.4. Tested: main.information_schema_keywords passes.

Note: EXTERNAL (9.4) and SETS (9.6) have the same issue in newer branches.

Thank you, Yakir Gibraltar
[23 Apr 20:10] Evan Elias
As of 9.7.0, SETS is no longer treated as reserved, per https://bugs.mysql.com/bug.php?id=119904

The other six ones previously mentioned here (CUBE, MANUAL, PARALLEL, QUALIFY, TABLESAMPLE, EXTERNAL) are still problematic in 9.7.0 though.