# Testcase for # Bug#36089 drop temp table in SP called by function, crash --disable_warnings DROP TEMPORARY TABLE IF EXISTS t1; DROP PROCEDURE IF EXISTS p1; DROP FUNCTION IF EXISTS f1; --enable_warnings CREATE TEMPORARY TABLE t1 AS SELECT 1 AS a; delimiter |; CREATE PROCEDURE p1() BEGIN DROP TEMPORARY TABLE t1; CREATE TEMPORARY TABLE t1 AS SELECT 'abc' AS a; end| CREATE FUNCTION f1() RETURNS INT BEGIN CALL p1(); RETURN 1; END| delimiter ;| --echo # The next SELECT causes a crash. SELECT 1 FROM t1 HAVING COUNT(*) = f1(); DROP TEMPORARY TABLE t1; DROP PROCEDURE p1; DROP FUNCTION f1;