Bug #107735 Select Rows feature does not handle table names starting with number err 1064
Submitted: 2 Jul 2022 13:13 Modified: 3 Jul 2022 7:49
Reporter: Julian Noble Email Updates:
Status: Verified Impact on me:
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:8.0, 8.0.29 OS:Any
Assigned to: CPU Architecture:Any
Tags: 1064, quoting, SQL Syntax, tablename

[2 Jul 2022 13:13] Julian Noble
Right clicking on a table and selecting 'Select Rows' generates a SELECT query which does not quote the table name - but for tables named such as 1etc
the query window displays Error Code: 1064 stating there is an error in the SQL syntax

The tooltip on hovering over the SQL says
".1" is not valid at this position, expecting EOF, ";"

How to repeat:
Create a table named such that it starts with a number

Right click on table name and 'Select Rows'

Generated query is not usable without editing

(note that some products e.g frontaccounting generate tables named with numeric prefixes 0_  1_ etc)

Suggested fix:
Manually quoting the table name works - but MySQL workbench should either do this automatically - or else not mark it as an error(?)

According to the MySQL reference manual:
"Identifiers may begin with a digit but unless quoted may not consist solely of digits."

Tables such as 1etc should theoretically not require quoting - so the 1064 error is unexpected.

This was tested on version 5.x and 8.x MySQL servers.
[3 Jul 2022 7:49] MySQL Verification Team
Hello Julian Noble,

Thank you for the report and feedback.