--source include/have_innodb.inc DROP TABLE IF EXISTS Test; CREATE TABLE Test(x int primary key, y int) ENGINE=innodb; INSERT Test VALUES (1, 0), (2, 0), (3, 0), (4, 0), (5, 0); DELIMITER $$; DROP FUNCTION IF EXISTS `Func`$$ CREATE FUNCTION `Func`(z int) RETURNS int READS SQL DATA RETURN (SELECT x FROM Test WHERE x = z) $$ DELIMITER ;$$ START TRANSACTION; SELECT Func(1); connect (addconroot, localhost, root,,); connection addconroot; START TRANSACTION; SELECT Func(1); UPDATE Test SET y = 1 WHERE x = 1;