Bug #1383 some aliases cause a syntax error
Submitted: 23 Sep 2003 9:50 Modified: 25 Sep 2003 12:34
Reporter: Joerg Albrecht Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1 OS:Windows (WIN2k)
Assigned to: CPU Architecture:Any

[23 Sep 2003 9:50] Joerg Albrecht
Description:
Hi,

after having updated my mysql Server from 4.0 to 4.1 I had to notice, that some queries didn't work any more. After doing some try and error I found out, that some aliases cause a syntax-error, which they did not cause in the older version.

I.e.:
An alias "mod" for a table "modules" containing fields like "MOD_ID" causes an error!

How to repeat:
create a tabel called modules with fileds like MOD_ID, MOD_name, etc.
try to select from the table like this:

SELECT mod.MOD_ID FROM modules AS mod WHERE 1

Suggested fix:
no suggestion
[25 Sep 2003 12:34] Indrek Siitan
"mod" (a mathematical operation) has been added to the list of reserved
words in 4.1.

To overcome the problem, enclose the reserved word in backticks, e.g.:
SELECT mod.MOD_ID FROM modules AS `mod` WHERE 1;