Bug #26432 SELECT with an unknown column create an "Unknown error" in SHOW ERRORS;
Submitted: 15 Feb 2007 23:45 Modified: 29 Jun 2007 0:10
Reporter: jocelyn fournier (Silver Quality Contributor) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1.14,5.2, 5.0 BK OS:Linux (Linux)
Assigned to: Assigned Account CPU Architecture:Any
Tags: qc

[15 Feb 2007 23:45] jocelyn fournier
Description:
Hi,

When using a SELECT with an unknown column, an "Unknown error" is inserted in the results returned by SHOW ERRORS.

How to repeat:
mysql> SELECT t;
ERROR 1054 (42S22): Unknown column 't' in 'field list'
mysql> SHOW ERRORS;
+-------+------+------------------------------------+
| Level | Code | Message                            |
+-------+------+------------------------------------+
| Error | 1054 | Unknown column 't' in 'field list' |
| Error | 1105 | Unknown error                      |
+-------+------+------------------------------------+
2 rows in set (0.00 sec)

Regards,
  Jocelyn Fournier
  http://www.mesdiscussions.net
[16 Feb 2007 10:26] Sveta Smirnova
Thank you for the report.

Verified as described.
[21 Feb 2007 19:56] Konstantin Osipov
The bug comes from this place in sql_select.cc:
  if (unlikely(res))
  {
    /* If we had a another error reported earlier then this will be ignored */
    result->send_error(ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR));
    result->abort();
  }

The comment is incorrect.
The patch is either to change the if to be as in 4.1:
if (res < 0 || thd->net.report_error)
or to simply remove the call to send_error and add an assert that thd->net.report_error is never set and res is never < 0 (preferrable, for 5.1).
[18 Jun 2007 15:03] Konstantin Osipov
This bug is a duplicate of Bug#28677 "SELECT on missing column gives extra error"