Bug #64626 Warnings are not cleared when a query hits the cache
Submitted: 12 Mar 2012 19:25 Modified: 12 Mar 2012 22:57
Reporter: Jeremy Michelson Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.5.17 OS:Any
Assigned to: CPU Architecture:Any

[12 Mar 2012 19:25] Jeremy Michelson
Description:
`SHOW WARNINGS` incorrectly displays warnings from an earlier query if the most recent query hit the query cache.

How to repeat:
Suppose that the table test.test_table exists but test.test_table_nope does not exist.  Then

mysql> select * from test.test_table_nope;
ERROR 1146 (42S02): Table 'test.test_table_nope' doesn't exist
mysql> select * from test.test_table;
Empty set (0.16 sec)
mysql> show warnings;
Empty set (0.00 sec)

mysql> select * from test.test_table_nope;
ERROR 1146 (42S02): Table 'test.test_table_nope' doesn't exist
mysql> select * from test.test_table;
Empty set (0.00 sec)
mysql> show warnings;
+-------+------+--------------------------------------------+
| Level | Code | Message                                    |
+-------+------+--------------------------------------------+
| Error | 1146 | Table 'test.test_table_nope' doesn't exist |
+-------+------+--------------------------------------------+
1 row in set (0.00 sec)

Since both sets of 3 queries were identical, I expected the second SHOW WARNINGS to also return an empty set.  (Expected behavior is seen with SQL_NO_CACHE but that's not necessarily desirable.)
[12 Mar 2012 22:57] MySQL Verification Team
Thank you for the bug report. Duplicate of http://bugs.mysql.com/bug.php?id=49634.