Bug #1920 error in SQL query parsing when LIMIT is used as an alias to the column name
Submitted: 23 Nov 2003 4:34 Modified: 23 Nov 2003 17:16
Reporter: Mind Tune Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:3.23.59 OS:FreeBSD (FreeBSD 4.8)
Assigned to: CPU Architecture:Any

[23 Nov 2003 4:34] Mind Tune
Description:
See "How to repeat" :-]

How to repeat:
mysql> select d.I as ID,d.T as TYPE,d.L as LIM,d.C,d.E,d.N from QAD d join QAC b where d.E=b.I;
+----+------+-----+---+---+--------------------------------------+
| ID | TYPE | LIM | C | E | N                                    |
+----+------+-----+---+---+--------------------------------------+
|  1 |    0 |   0 | 0 | 0 | #0a Default block                    |
|  2 |    1 |   0 | 0 | 0 | #1a Test block (text)                |
|  3 |    2 |   0 | 0 | 0 | #1b Test block (html)                |
|  4 |    1 |  10 | 0 | 0 | #2a Test block (text, limited shows) |
|  5 |    2 |  10 | 0 | 0 | #2b Test block (html, limited shows) |
|  6 |    1 |   0 | 0 | 1 | #2a Test block (text, charset)       |
|  7 |    2 |   0 | 0 | 1 | #2b Test block (html, charset)       |
+----+------+-----+---+---+--------------------------------------+
7 rows in set (0.00 sec)

mysql> select d.I as ID,d.T as TYPE,d.L as LIMIT,d.C,d.E,d.N from QAD d join QAC b where d.E=b.I;
ERROR 1064: You have an error in your SQL syntax near 'LIMIT,d.C,d.E,d.N from QAD d join QAC b where d.E=b.I' at line 1
mysql>

Suggested fix:
Fix the parser.
[23 Nov 2003 4:35] Mind Tune
... and the db handler is innodb :}~
[23 Nov 2003 17:16] Alexander Keremidarski
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

LIMIT is reserved word