1drop table if exists t1; 2SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; 3connect a,localhost,root,,; 4connect b,localhost,root,,; 5SET GLOBAL log_bin_trust_function_creators = 1; 6create table t1 (col1 integer primary key, col2 integer) engine=innodb; 7insert t1 values (1,100); 8create function f1 () returns integer begin 9declare var1 int; 10select col2 into var1 from t1 where col1=1 for update; 11return var1; 12end| 13start transaction; 14select f1(); 15f1() 16100 17connection b; 18update t1 set col2=0 where col1=1; 19connection default; 20select * from t1; 21col1 col2 221 100 23connection a; 24rollback; 25connection b; 26rollback; 27connection a; 28disconnect a; 29connection b; 30disconnect b; 31connection default; 32drop table t1; 33drop function f1; 34SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; 35