[MDEV-30424] select @@warning_count returns wrong result Created: 2023-01-17  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.10.3
Fix Version/s: 10.11

Type: Bug Priority: Minor
Reporter: Georg Richter Assignee: Oleksandr Byelkin
Resolution: Unresolved Votes: 0
Labels: None


 Description   

If the number of warnings is greater than max_error_count, session variable @@warning_count has incorrect value.

How to repeat:

delimiter $$
CREATE PROCEDURE p1() BEGIN  DROP TABLE whichdoesnotexist; END $$
CREATE PROCEDURE p2() BEGIN  CALL p1(); END  $$
CREATE PROCEDURE p3() BEGIN  CALL p2(); END  $$
delimiter ;
 
SET @@max_error_count=2;
CALL  p3();
SELECT @@warning_count;
+-----------------+
| @@warning_count |
+-----------------+
|               3 |
+-----------------+
SHOW WARNINGS;
+-------+------+----------------------------------------+
| Level | Code | Message                                |
+-------+------+----------------------------------------+
| Error | 1051 | Unknown table 'test.whichdoesnotexist' |
| Note  | 4094 | At line 2 in test.p1                   |
+-------+------+----------------------------------------+
 
set @@max_error_count=4;
call p3();
select @@warning_count;
+-----------------+
| @@warning_count |
+-----------------+
|               4 |
+-----------------+
show warnings;
+-------+------+----------------------------------------+
| Level | Code | Message                                |
+-------+------+----------------------------------------+
| Error | 1051 | Unknown table 'test.whichdoesnotexist' |
| Note  | 4094 | At line 2 in test.p1                   |
| Note  | 4094 | At line 2 in test.p2                   |
| Note  | 4094 | At line 2 in test.p3                   |
+-------+------+----------------------------------------+


Generated at Thu Feb 08 10:16:09 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.