Bug #25366 Easily check reserved words
Submitted: 2 Jan 2007 15:17 Modified: 15 Dec 2010 14:13
Reporter: Shiraz Esat Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: General Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any

[2 Jan 2007 15:17] Shiraz Esat
Could all reserved words be stored in the 'mysql' database? (similar to how the help_% tables now exist).


How to repeat:
When creating tables/databases dynamically it would be good to quickly check whether the new table/db name is reserved or not.

Suggested fix:
Store list of reserved words in mysql.reserved_words.

Actually, would 'mysql.help_keyword' contain what I'm after!!!
[2 Jan 2007 15:26] Shiraz Esat
It seems that there are items in the list of reserved words that aren't in mysql.help_keyword (and I haven't yet checked if there are items in mysql.help_keyword that aren't in the list of reserved words).

Thanks again
[15 Dec 2010 14:13] Valeriy Kravchuk
In 5.1.52, for example, I see 452 rows in the mysql.help_keyword table, but much less keywords (228 as far as I can see) are mentioned in http://dev.mysql.com/doc/mysqld-version-reference/en/mysqld-version-reference-reservedword.... These should be kept in sync.
[8 Jun 2015 15:36] Paul Dubois
The mysql.help_keywords table does not actually list the words that are considered keywords or reserved words by the parser. It simply lists significant terms for the help system.

From a documentation standpoint, the reference manual now has a table showing the set of SQL keywords here:


The table flags keywords that are reserved words using "(R)".

Including this information in a table that is queryable at runtime requires coordination with the server team. I've made some inquiries toward that end.
[9 Aug 2019 15:03] Daniƫl van Eeden
Being able to do "SELECT keyword FROM performance_schema.keywords WHERE reserved=TRUE" would be very useful.

Especially for tools (Workbench, custom tools) to warn developers about column names that are also keywords and are probably not the best name for a column.