Bug #9649 Stored Procedures: Show warnings shows incorrect information
Submitted: 5 Apr 2005 14:37 Modified: 14 Sep 2005 13:39
Reporter: Disha Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.3 Beta OS:Windows (Windows 2003)
Assigned to: CPU Architecture:Any

[5 Apr 2005 14:37] Disha
Description:
Create a function 'fn1' which does some arthematic operation. It give a warning and after executing 'show warnings' statement, it displays incorrect Level and Message.

How to repeat:
Drop function if exists fn1//
Create function fn1(F1 SMALLINT ) returns SMALLINT
Begin
    set @y = (-6) / 2;
    return @y;
End// 
Select fn1(15)//
Show warnings//

ACTUAL RESULT:
+-------+------+-----------------------------------------------------+
| Level | Code | Message                                             |
+-------+------+-----------------------------------------------------+
| Error | 1264 | Out of range value adjusted for column '' at row -1 |
+-------+------+-----------------------------------------------------+
	1 row in set (0.00 sec)

EXPECTED RESULT:
+-------+------+-----------------------------------------------------+
| Level | Code | Message                                             |
+-------+------+-----------------------------------------------------+
| Warning | 1264 | Out of range value adjusted for column '' at row 1 |
+-------+------+-----------------------------------------------------+
	1 row in set (0.00 sec)
[24 Aug 2005 11:51] Georg Richter
can't repeat with 5.0.12 - no warnings are shown

mysql> Select fn1(15)//
+---------+
| fn1(15) |
+---------+
|      -3 |
+---------+
1 row in set (0.00 sec)

mysql> Show warnings//
Empty set (0.00 sec)
[14 Sep 2005 13:39] Valeriy Kravchuk
Can't repeat on 5.0.13-BK on linux also:

mysql> Drop function if exists fn1//
Query OK, 0 rows affected (0,00 sec)

rmysql> Create function fn1(F1 SMALLINT ) returns SMALLINT
    -> Begin
    ->     set @y = (-6) / 2;
    ->     return @y;
    -> End//
Query OK, 0 rows affected (0,00 sec)

mysql> Select fn1(15)//
+---------+
| fn1(15) |
+---------+
|      -3 |
+---------+
1 row in set (0,00 sec)

mysql> Show warnings//
Empty set (0,00 sec)

No warnings and no need for them. Everything works as expected.