Bug #40485 Incorrect warning count
Submitted: 3 Nov 2008 23:07 Modified: 28 Oct 2011 9:37
Reporter: Paul Keenan Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Errors Severity:S3 (Non-critical)
Version:5.0.67, 5.0.70, 5.1.29 OS:MacOS
Assigned to: Jon Olav Hauglid CPU Architecture:Any
Tags: warnings

[3 Nov 2008 23:07] Paul Keenan
Description:
The attached code should generate 3 warnings, however the server returns a contradictory message "Records: 3  Duplicates: 0  Warnings: 2".  The same behaviour occurs when the server is Mac OS X or Windows.

How to repeat:
mysql> create table integers(i int unsigned not null);
Query OK, 0 rows affected (0.13 sec)

mysql> insert into integers values('abc'),(-3),(NULL);
Query OK, 3 rows affected, 3 warnings (1.27 sec)
Records: 3  Duplicates: 0  Warnings: 2

mysql> show warnings;
+---------+------+--------------------------------------------------------+
| Level   | Code | Message                                                |
+---------+------+--------------------------------------------------------+
| Warning | 1366 | Incorrect integer value: 'abc' for column 'i' at row 1 |
| Warning | 1264 | Out of range value adjusted for column 'i' at row 2    |
| Warning | 1048 | Column 'i' cannot be null                              |
+---------+------+--------------------------------------------------------+
3 rows in set (0.05 sec)
[4 Nov 2008 5:02] Valeriy Kravchuk
Verified just as described:

C:\Program Files\MySQL\MySQL Server 5.0\bin>mysql -P3310 -uroot -proot test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.1.29-rc-community-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create table integers(i int unsigned not null);
Query OK, 0 rows affected (0.48 sec)

mysql> set sql_mode='';
Query OK, 0 rows affected (0.08 sec)

mysql> insert into integers values('abc'),(-3),(NULL);
Query OK, 3 rows affected, 3 warnings (0.22 sec)
Records: 3  Duplicates: 0  Warnings: 2

mysql> show warnings;
+---------+------+--------------------------------------------------------+
| Level   | Code | Message                                                |
+---------+------+--------------------------------------------------------+
| Warning | 1366 | Incorrect integer value: 'abc' for column 'i' at row 1 |
| Warning | 1264 | Out of range value for column 'i' at row 2             |
| Warning | 1048 | Column 'i' cannot be null                              |
+---------+------+--------------------------------------------------------+
3 rows in set (0.00 sec)
[12 Oct 2011 16:40] Jon Olav Hauglid
Not repeatable on current 5.6.4-m6:

mysql> insert into integers values('abc'),(-3),(NULL);
Query OK, 3 rows affected, 3 warnings (0.00 sec)
Records: 3  Duplicates: 0  Warnings: 3

Closing the bug.
[27 Oct 2011 15:17] Paul Keenan
Good news indeed.

However, if it was confirmed on a previous version, and now the bug can't be reproduced, shouldn't the status be something like "Fixed" ?

Cheers,
Paul
[28 Oct 2011 6:19] Jon Olav Hauglid
We have several "end states" for bug reports:
"Can't repeat", "Closed", "Duplicate", "Not a bug", "Unsupported", "Won't fix".
I tend to use "Closed" if I know exactly how/when the bug was fixed.
In this case, I don't. So I used "Can't repeat".
In the end, it makes no real difference which end state is used.

Btw, this bug is gone in the current 5.5 release version as well.
[28 Oct 2011 9:37] Paul Keenan
Thanks for the explanation.

Cheers,
Paul