/**
 * Run this script and monitor server memory to make sure
 * there are no memory leaks.
 */

DELIMITER $$
CREATE PROCEDURE udf_test(vLoops BIGINT)
BEGIN
	DECLARE vI BIGINT DEFAULT 0;
	DECLARE vRes VARCHAR(255);

	WHILE vI < vLoops DO
		SELECT minacum(2, -10, 1) INTO vRes;
		SELECT multimax(10, 20) INTO vRes;
		SELECT sql_printf('SELECT %v FROM %t', TRUE, 'myTable') INTO vRes;
		SET vI = vI + 1;
	END WHILE;
END$$
DELIMITER ;

CALL udf_test(POW(10, 7));

DROP PROCEDURE udf_test;
