Description:
In 'real world' warning counts do not seem to behave as documented in
http://dev.mysql.com/doc/refman/5.0/en/show-warnings.html
"select count(*) warnings;" seems always to return '1'
How to repeat:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.0.45-community-nt MySQL Community Edition (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> select version();
+---------------------+
| version() |
+---------------------+
| 5.0.45-community-nt |
+---------------------+
1 row in set (0.08 sec)
mysql> show variables like 'max_error_count';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_error_count | 64 |
+-----------------+-------+
1 row in set (0.00 sec)
mysql> select count(*) warnings;
+----------+
| warnings |
+----------+
| 1 |
+----------+
1 row in set (0.00 sec)
mysql> show warnings;
Empty set (0.00 sec)
mysql> use test;
Database changed
mysql> select * from blabla;
ERROR 1146 (42S02): Table 'test.blabla' doesn't exist
mysql> select count(*) warnings;
+----------+
| warnings |
+----------+
| 1 |
+----------+
1 row in set (0.00 sec)
mysql> SELECT @@warning_count;
+-----------------+
| @@warning_count |
+-----------------+
| 1 |
+-----------------+
1 row in set (0.00 sec)
mysql> show warnings;
+-------+------+-----------------------------------+
| Level | Code | Message |
+-------+------+-----------------------------------+
| Error | 1146 | Table 'test.blabla' doesn't exist |
+-------+------+-----------------------------------+
1 row in set (0.00 sec)
mysql> select a,b,c from dummy; -- the table exists, columns do not
ERROR 1054 (42S22): Unknown column 'a' in 'field list'
mysql> select count(*) warnings;
+----------+
| warnings |
+----------+
| 1 |
+----------+
1 row in set (0.00 sec)
mysql> SELECT @@warning_count;
+-----------------+
| @@warning_count |
+-----------------+
| 2 |
+-----------------+
1 row in set (0.00 sec)
mysql> show warnings;
+-------+------+------------------------------------+
| Level | Code | Message |
+-------+------+------------------------------------+
| Error | 1054 | Unknown column 'a' in 'field list' |
| Error | 1105 | Unknown error |
+-------+------+------------------------------------+
2 rows in set (0.00 sec)
Suggested fix:
I think this is a plain bug with "select count(*) warnings;", that should be fixed!