Bug #3552 | Wrong error message with table update clause:ERROR 1054: | ||
---|---|---|---|
Submitted: | 23 Apr 2004 12:31 | Modified: | 5 Dec 2005 11:33 |
Reporter: | Philip | Email Updates: | |
Status: | Won't fix | Impact on me: | |
Category: | MySQL Server | Severity: | S4 (Feature request) |
Version: | 4.0.18-log | OS: | Any (all) |
Assigned to: | CPU Architecture: | Any |
[23 Apr 2004 12:31]
Philip
[26 Apr 2004 23:26]
Marko Mäkelä
The SQL parser of MySQL accepts table aliases in the UPDATE clause. What you wrote is equivalent to UPDATE t1 AS info SET aa=1;. It is very hard to implement robust error recovery and accurate error reporting.
[27 Apr 2004 13:58]
Philip
Marko, Very good point, maybe if the message was unknown column t1.aa or info.aa then it would be more clear that the problem was actually with the table name rather than the column…
[27 Apr 2004 16:39]
Dean Ellis
I am changing this to a feature request for a more specific error message.
[5 Dec 2005 11:33]
Valeriy Kravchuk
I do not think, that somebody will fix it really. MySQL supports multiple tables update, and in this case what table name should be appended? Current error message clearly explains, that the table(s) you refer to has no such column. If you'll refer to the table that does not exist, you'll get the other error message: mysql> desc tcc1; +-------+---------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+---------+------+-----+---------+-------+ | c1 | int(11) | YES | UNI | NULL | | | c2 | int(11) | YES | UNI | NULL | | +-------+---------+------+-----+---------+-------+ 2 rows in set (1.03 sec) mysql> update tcc1 a set c11 = 10; ERROR 1054 (42S22): Unknown column 'c11' in 'field list' mysql> update tcc2 a set c11 = 10; ERROR 1146 (42S02): Table 'test.tcc2' doesn't exist And, in any case, you may have another table, with that column, and simply update it by such a mistake. DBMS can not check and prevent all such user errors.