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.
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.