Bug #15525 Misleading error when selecting non-existant keyword
Submitted: 6 Dec 2005 16:05 Modified: 21 Dec 2005 9:32
Reporter: Kolbe Kegel Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Errors Severity:S4 (Feature request)
Version:5.0.x, 5.1.3 OS:Linux (Linux)
Assigned to: CPU Architecture:Any

[6 Dec 2005 16:05] Kolbe Kegel
Description:
MySQL has a certain set of functions that can be executed without any parentheses (CURRENT_DATE, for example).

If a user specifies a non-existent function in such a way, the error message is misleading and is not adequately descriptive.

How to repeat:

select current_date;

select something;
-- ERROR 1054 (42S22): Unknown column 'something' in 'field list'

select nothing;
-- ERROR 1054 (42S22): Unknown column 'something' in 'field list'

Suggested fix:
In the first example, "current_date" is not a "column", even though it is the only thing present in the field list. Furthermore, there can't really be columns (unless referring to output or result sets) if there is no FROM clause, which is the case in these examples.

The error message should provide a clearer explanation of what the problem is.
[20 Dec 2005 15:41] Aleksey Kishkin
I dont think it's a feature request but rather bugreport.
[21 Dec 2005 9:32] Valeriy Kravchuk
Thank you for a problem report. Verified just as described:

mysql> select now;
ERROR 1054 (42S22): Unknown column 'now' in 'field list'
mysql> select current_date;
+--------------+
| current_date |
+--------------+
| 2005-12-21   |
+--------------+
1 row in set (0.03 sec)

mysql> select something;
ERROR 1054 (42S22): Unknown column 'something' in 'field list'

This error message is misleading. But may be 'field' is just a name for any element in a list after SELECT statement? Why not? 

So, I think, it is really a feature request to distinguish these SELECTs without FROM and give some other error message in such cases.