Bug #9561 Stored Procedures: All warnings not displayed when a sproc is called.
Submitted: 1 Apr 2005 15:26 Modified: 1 Apr 2005 17:06
Reporter: Disha Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.3 OS:Microsoft Windows (Windows 2003)
Assigned to: CPU Architecture:Any

[1 Apr 2005 15:26] Disha
Description:
In a function, there are 2 insert statements that cause truncation. Hence 3 warnings should be displayed. The warning count is also displayed as 3. However just 1 warning is displayed with 'show warnings//'

How to repeat:
1. Create tables.
             Create table res_innodb (f1 tinyint) engine = InnoDB//
	Create table res_myisam (f2 tinyint) engine = MyISAM//
	Create table res_memory (f3 tinyint) engine = Memory//

2. Create a function 'fn1' by executing the following SQL statement:
	Create function fn1(F1 TINYINT) returns TINYINT
 	Begin
         		set @y = 1000;
 		insert into res_innodb values (@y);
 		insert into res_myisam values (@y);
 		insert into res_memory values (@y);
         		return @y;
 	End// 
3. Select fn1()// 
4. Show warnings//

ACTUAL RESULT:
After step 3,
+--------+
| fn1(1) |
+--------+
|   1000 |
+--------+
1 row in set, 3 warnings (0.02 sec)

After step 4,
+---------+------+------------------------------------------------------+
| Level   | Code | Message                                              |
+---------+------+------------------------------------------------------+
| Warning | 1264 | Out of range value adjusted for column 'f3' at row 1 |
+---------+------+------------------------------------------------------+
1 row in set (0.00 sec)

EXPECTED RESULT:
After step 3, It should display 3 warnings.
[1 Apr 2005 15:29] Disha
This is observed in case of functions as well as stored procedures.
[1 Apr 2005 15:52] MySQL Verification Team
According explained in Manual:
^
http://dev.mysql.com/doc/mysql/en/show-warnings.html

SHOW WARNINGS shows the error, warning, and note messages that resulted from the last statement that generated messages, or nothing if the last
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
statement that used a table generated no messages. This statement is implemented as of MySQL 4.1.0. A related statement, SHOW ERRORS, shows only the errors.
[1 Apr 2005 17:06] Sergei Golubchik
duplicate of http://bugs.mysql.com/9004