Bug #7549 Missing error message for invalid view selection with subquery
Submitted: 27 Dec 2004 21:28 Modified: 17 May 2006 18:33
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S3 (Non-critical)
Version:5.0.3-alpha-debug OS:Linux (SUSE 9.2)
Assigned to: Georgi Kodinov CPU Architecture:Any

[27 Dec 2004 21:28] Peter Gulutzan
Description:
If I use a column name in a WHERE clause in a SELECT in a CREATE VIEW, and the column 
does not exist, I expect an error message. Usually I get one. But I don't get one for quantified 
comparisons ( SOME|ALL|ANY). If I do the SELECT without CREATE VIEW, I get: 
ERROR 1054 (42S22): Unknown column 'no_such_column' in 'scalar IN/ALL/ANY subquery' 
Incidentally, I think a better error message would be: 
ERROR 1054 (42S22): Unknown column 'no_such_column' with 'IN/ALL/ANY subquery' 
 
 
 
 
 
 

How to repeat:
/* after "create table t (column1 int)" */ 
 
mysql> create view vkj as select * from t where no_such_column = any (select 1); 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> create view vkj as select * from t where no_such_column = (select 1); 
ERROR 1054 (42S22): Unknown column 'no_such_column' in 'where clause' 
 
mysql> select * from t where no_such_column = any (select 1); 
ERROR 1054 (42S22): Unknown column 'no_such_column' in 'scalar IN/ALL/ANY subquery'
[27 Dec 2004 22:10] MySQL Verification Team
Thank you for the bug report.
[10 May 2006 16:55] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/6205
[11 May 2006 12:30] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/6249
[12 May 2006 15:57] Georgi Kodinov
pushed in 5.0.22
[17 May 2006 18:33] Paul DuBois
Noted in 5.0.22 changelog.

For certain <literal>CREATE VIEW</literal> statements, the
server did not detect invalid subqueries within the
<literal>SELECT </literal> part.