Bug #2015 LIMIT syntax error causes access violation error
Submitted: 4 Dec 2003 9:40 Modified: 4 Dec 2003 15:37
Reporter: Jen Horne Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S2 (Serious)
Version:4.0.13 OS:Windows (Windows NT/2k)
Assigned to: Dean Ellis CPU Architecture:Any

[4 Dec 2003 9:40] Jen Horne
Description:
A syntax error in a SELECT statement running from a VB6 application where the statement was missing a space between LIMIT and the variable caused a trappable DrWatson error rather than generating a syntax error warning.  The error occurred when the application tried to open a recordset using the SQL statement.

The statement was as follows.  
"SELECT * FROM ArchiveQueue LIMIT" & miLoadLimit

This was reproduced using a database viewer application, and also using the MySQLCC, by simply entering that SQL.  

Our error logging returned the following error: -1073741819.  It also returned the following VB error number 10000, and the description of the error was "Access Violation Error".
  

How to repeat:
Use the SELECT statement with no space.

Suggested fix:
Instead of giving an access violation for a syntax error, give a syntax error warning more in keeping with the way other syntax errors display.
[4 Dec 2003 15:37] Dean Ellis
I am unable to duplicate this using 4.0.17.  You may wish to use the current stable release.

That query should be accepted, with "LIMIT12345" interpreted as a table alias.  There is, technically, no syntax error there.

Thank you