Bug #61832 No error message shown, though there is no column entry as 5 in table
Submitted: 12 Jul 2011 10:58 Modified: 12 Jul 2011 11:19
Reporter: Emmanuel Giftson Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version: OS:Linux
Assigned to: CPU Architecture:Any

[12 Jul 2011 10:58] Emmanuel Giftson
Description:
mysql> select * from TEST;
+------+------+------+------+----------+
| a    | b    | c    | d    | e        |
+------+------+------+------+----------+
|    3 |   12 |    3 |    4 | TESTHGVJ |
|    3 |   26 |   65 |  545 | esa      |
+------+------+------+------+----------+
2 rows in set (0.00 sec)

mysql> select 5 from TEST where d=4;
+---+
| 5 |
+---+
| 5 |
+---+
1 row in set (0.00 sec)

How to repeat:
mysql> select * from TEST;
+------+------+------+------+----------+
| a    | b    | c    | d    | e        |
+------+------+------+------+----------+
|    3 |   12 |    3 |    4 | TESTHGVJ |
|    3 |   26 |   65 |  545 | esa      |
+------+------+------+------+----------+
2 rows in set (0.00 sec)

mysql> select 5 from TEST where d=4;
+---+
| 5 |
+---+
| 5 |
+---+
1 row in set (0.00 sec)
[12 Jul 2011 11:14] Valeriy Kravchuk
This is not a bug. You can use constants (like 5) and expressions of arbitrary complexity in SELECT clause, both containing references to column(s) from the table(s) used in FROM clause or not referencing any columns. See http://dev.mysql.com/doc/refman/5.1/en/select.html.