Bug #9004 Inconsistent behaviour of SP re. warnings
Submitted: 7 Mar 2005 7:24 Modified: 22 Apr 2005 12:49
Reporter: Sergei Golubchik Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0 OS:
Assigned to: Per-Erik Martin CPU Architecture:Any

[7 Mar 2005 7:24] Sergei Golubchik
Description:
SP hide any warnings from the caller.
But one can see them in traditional mode.
This is inconsistent.

How to repeat:
delimiter |
create procedure two(x1 char(16), x2 char(16), y int)
begin
  insert into test.t1 values (x1, y);
  insert into test.t1 values (x2, y);
end|
delimiter ;

create table t1 ( id   char(16) not null, data int not null);
call two("one", "two", 3); select * from t1;
insert into test.t1 values ("oneaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 3);
call two("oneaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "two", 3);
# no warnings here
set sql_mode='traditional';
call two("oneaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "two", 3);
# ERROR 1406 (22001): Data too long for column 'id' at row 1

Suggested fix:
Make SHOW WARNINGS to return all warnings that were generated during SP execution
[22 Apr 2005 11:14] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/24222