Bug #41283 Warning count reported to be 1 and 0 at the same time
Submitted: 6 Dec 2008 23:05 Modified: 2 Nov 2019 13:44
Reporter: Tomas Telensky Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.0.67-log, 5.1.30, 6.0.7 OS:Linux
Assigned to: CPU Architecture:Any
Tags: count, warning

[6 Dec 2008 23:05] Tomas Telensky
Description:
When running insert .. values(), () ... the warning count is reported two times - being 1 and being 0. Correct warning count is 1.

How to repeat:
drop table if exists a;

create table a (
        a int auto_increment primary key,
        b int not null
);

select * from a;

insert into a (a) values(0);

insert into a (a) values(0), (0); /* warning count in the 2nd line is 0! */
[7 Dec 2008 17:24] Valeriy Kravchuk
Indeed, number of warnings is a bit misleading:

mysql> insert into a (a) values(0);
Query OK, 1 row affected, 1 warning (0.00 sec)

mysql> insert into a (a) values(0), (0);
Query OK, 2 rows affected, 1 warning (0.00 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> show warnings\G
*************************** 1. row ***************************
  Level: Warning
   Code: 1364
Message: Field 'b' doesn't have a default value
1 row in set (0.08 sec)
[2 Nov 2019 13:44] Roy Lyseng
Posted by developer:
 
Fixed in 5.7.