Bug #800 SELECT doesn't return syntax error when selecting two columns without comma
Submitted: 7 Jul 2003 4:02 Modified: 7 Jul 2003 4:24
Reporter: Pavel Francirek Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0.13 OS:Linux (Linux)
Assigned to: CPU Architecture:Any

[7 Jul 2003 4:02] Pavel Francirek
Description:
SELECT doesn't return syntax error when selecting two columns without comma.
ex:

SELECT colA colB FROM table;

returns only colB. Both colA and colB must exist in table. 

Tree columns already returns:
mysql> select colA colB colC FROM table;  
ERROR 1064: You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'colC FROM table' at line 1

Table is InnoDB.

How to repeat:
SELECT colA colB FROM table;
[7 Jul 2003 4:24] Sergei Golubchik
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

In

SELECT colA colB FROM table;

colB is treated as an alias for colA. It's the same as

SELECT colA AS colB FROM table;