Bug #26394 | IF error message "ERROR 1054 (42S22): Unknown column 'X' in 'field list'" | ||
---|---|---|---|
Submitted: | 15 Feb 2007 8:20 | Modified: | 15 Feb 2007 9:40 |
Reporter: | Roland Bouman | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Stored Routines | Severity: | S3 (Non-critical) |
Version: | 5.0.36-NK, all | OS: | Linux (Linux) |
Assigned to: | Marc ALFF | CPU Architecture: | Any |
Tags: | 42S22, error 1054, IF, IF...THEN, stored procedure, Unknown column |
[15 Feb 2007 8:20]
Roland Bouman
[15 Feb 2007 9:40]
Valeriy Kravchuk
Thank you for a bug report. Verified just as described with latest 5.0.36-BK on Linux: openxs@suse:~/dbs/5.0> bin/mysql -uroot test Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.0.36 Source distribution Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> create table thisReallyIsATable( -> thisIsNotAColum int -> ); Query OK, 0 rows affected (0.02 sec) mysql> delimiter // mysql> create procedure p_test() -> begin -> declare v_thisIsNotAColumn int; -> -> select thisIsNotAColumn -> into v_thisIsNotAColumn -> from thisReallyIsATable -> ; -> if -> thisIsNotAColumn = 0 -> then -> select 1; -> end if; -> end; -> // Query OK, 0 rows affected (0.05 sec) mysql> delimiter ; mysql> call p_test(); ERROR 1054 (42S22): Unknown column 'thisIsNotAColumn' in 'field list'
[21 Feb 2007 19:38]
Konstantin Osipov
Hi Marc, This is very close to the problem reported in Bug#5967 - internally it's a duplicate, but since it's another manifestation, I'm not closing it as such. When correct name resolution of SP variables is implemented, the error message will be automatically fixed as the SP variable name resolution context will be the last in the stack and will be used to issue an error when nothing is found in it. Right now the tables name resolution context is the last in the name resolution stack, hence the error. Bug#5967 is "To be fixed later".