Bug #93835 Display warning when keyword is used as identifier
Submitted: 7 Jan 2019 12:36 Modified: 10 Jan 2019 11:35
Reporter: Georgi Sotirov Email Updates:
Status: Verified Impact on me:
Category:MySQL Workbench: Modeling Severity:S4 (Feature request)
Version:8.0.13 OS:Any
Assigned to: CPU Architecture:Any

[7 Jan 2019 12:36] Georgi Sotirov
There are 679 keywords in MySQL 8 and almost 40% of them are 'reserved' as one could easily find querying INFORMATION_SCHEMA.keywords table in MySQL 8. In general it's not good to use keywords as identifiers in database schemas and it's not recommended (see https://lefred.be/content/mysql-8-0-and-keywords/ ), because this requires non-standard back tick escapes in SQL and [IMHO] makes reading SQL harder.
So now that there is a data dictionary table that provides information about all keywords in MySQL at run-time, perhaps it's a good idea to display a warning in MySQL Workbench when one models a new schema or creates new table and accidentally uses a keyword as identifier (e.g. schema/table/column, etc. name). This warning could be provided even before one applies the changes (e.g. before SQL is executed) helping the designer to chose a better name during the design of the schema or consecutive modifications.

How to repeat:
This is not a bug.

Suggested fix:
The warning could be indicated by a warn sign and a message in red (or other color by preference) next to the problematic table or column name like showed on the collage I created. The same applies for both SQL Editor and Modeling.
[7 Jan 2019 12:37] Georgi Sotirov
A collage with example how to display the warnings

Attachment: wb_keyword_warn.png (image/png, text), 26.98 KiB.

[10 Jan 2019 11:35] MySQL Verification Team
Hello Georgi,

Thank you for the feature request and feedback.