diff options
Diffstat (limited to 'mysql-test/t/sp-vars.test')
-rw-r--r-- | mysql-test/t/sp-vars.test | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/mysql-test/t/sp-vars.test b/mysql-test/t/sp-vars.test index 2cc68b054d5..fe063889f81 100644 --- a/mysql-test/t/sp-vars.test +++ b/mysql-test/t/sp-vars.test @@ -1412,3 +1412,39 @@ DROP PROCEDURE bug27415_text_test2| DELIMITER ;| # End of 5.0 tests. + +# +# Bug #26277 User variable returns one type in SELECT @v and other for CREATE as SELECT @v +# +--disable_warnings +drop function if exists f1; +drop table if exists t1; +--enable_warnings + +delimiter |; +create function f1() returns int +begin + if @a=1 then set @b='abc'; + else set @b=1; + end if; + set @a=1; + return 0; +end| + +create table t1 (a int)| +insert into t1 (a) values (1), (2)| + +set @b=1| +set @a=0| +select f1(), @b from t1| + +set @b:='test'| +set @a=0| +select f1(), @b from t1| + +delimiter ;| + +drop function f1; +drop table t1; +# End of 5.1 tests. + |