Bug #13808 ENUM type stored procedure parameter accepts non-enumerated data
Submitted: 6 Oct 2005 17:34 Modified: 7 Dec 2005 21:42
Reporter: Roland Bouman
Status: Closed
Category:Server: SP Severity:S2 (Serious)
Version:5.0.13/5.0 BK source OS:Microsoft Windows (Win XP/Linux)
Assigned to: Alexander Nozdrin Target Version:

[6 Oct 2005 17:34] Roland Bouman
Description:
A stored procedure can be defined with an ENUM datatype parameter. When calling such a
procedure, passing a value that is not enumerated in the ENUM type definition is
permitted. The procedure executes without warnings or errors.

This behaviour is quite unlike that of ENUM datatype columns in base tables. An insert of
a non-enumerated value into such a column will result in an error. 

It was expected that the behaviour of ENUM type stored procedure parameters would be
similar to that of ENUM type columns in base tables, that is, it was expected that the
procedure call would fail with an error indicating that the data is not valid for the
parameter..

How to repeat:
delimiter go

use test 
go

create procedure enump(
    p enum(
        'a'
    ,   'b'
    )
)
select p;
go

call enump('c')
go

+---+
| p |
+---+
| c |
+---+
1 row in set (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

create table enumt(
    c enum(
        'a'
    ,   'b'
    )
)
go

insert 
into    enumt 
values ('c')
go

ERROR 1265 (01000): Data truncated for column 'c' at row 1

Suggested fix:
Have the data passed to ENUM type stored procedure parameters checked in a similar way
data is checked for ENUM type table columns.
[7 Dec 2005 21:42] Paul DuBois
Noted in 5.0.18 changelog.