2009-10-26 10:55:57 +01:00
|
|
|
# Test file for stored procedure bugfixes
|
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # Bug #47412: Valgrind warnings / user can read uninitalized memory
|
|
|
|
--echo # using SP variables
|
|
|
|
--echo #
|
|
|
|
|
|
|
|
CREATE SCHEMA testdb;
|
|
|
|
USE testdb;
|
|
|
|
DELIMITER |;
|
|
|
|
CREATE FUNCTION f2 () RETURNS INTEGER
|
|
|
|
BEGIN
|
|
|
|
DECLARE CONTINUE HANDLER FOR SQLSTATE '42000' SET @aux = 1;
|
|
|
|
RETURN f_not_exists () ;
|
|
|
|
END|
|
|
|
|
CREATE PROCEDURE p3 ( arg1 VARCHAR(32) )
|
|
|
|
BEGIN
|
|
|
|
CALL p_not_exists ( );
|
|
|
|
END|
|
|
|
|
DELIMITER ;|
|
|
|
|
--echo # should not return valgrind warnings
|
|
|
|
--error ER_SP_DOES_NOT_EXIST
|
|
|
|
CALL p3 ( f2 () );
|
|
|
|
|
|
|
|
DROP SCHEMA testdb;
|
|
|
|
|
|
|
|
CREATE SCHEMA testdb;
|
|
|
|
USE testdb;
|
|
|
|
DELIMITER |;
|
|
|
|
CREATE FUNCTION f2 () RETURNS INTEGER
|
|
|
|
BEGIN
|
|
|
|
DECLARE CONTINUE HANDLER FOR SQLSTATE '42000' SET @aux = 1;
|
|
|
|
RETURN f_not_exists () ;
|
|
|
|
END|
|
|
|
|
CREATE PROCEDURE p3 ( arg2 INTEGER )
|
|
|
|
BEGIN
|
|
|
|
CALL p_not_exists ( );
|
|
|
|
END|
|
|
|
|
DELIMITER ;|
|
|
|
|
--echo # should not return valgrind warnings
|
|
|
|
--error ER_SP_DOES_NOT_EXIST
|
|
|
|
CALL p3 ( f2 () );
|
|
|
|
|
|
|
|
DROP SCHEMA testdb;
|
|
|
|
|
|
|
|
CREATE SCHEMA testdb;
|
|
|
|
USE testdb;
|
|
|
|
DELIMITER |;
|
|
|
|
CREATE FUNCTION f2 () RETURNS INTEGER
|
|
|
|
BEGIN
|
|
|
|
DECLARE CONTINUE HANDLER FOR SQLSTATE '42000' SET @aux = 1;
|
|
|
|
RETURN f_not_exists () ;
|
|
|
|
END|
|
|
|
|
DELIMITER ;|
|
|
|
|
--echo # should not return valgrind warnings
|
|
|
|
SELECT f2 ();
|
|
|
|
|
|
|
|
DROP SCHEMA testdb;
|
|
|
|
|
2010-01-28 15:41:14 +01:00
|
|
|
USE test;
|
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # Bug#50423: Crash on second call of a procedure dropping a trigger
|
|
|
|
--echo #
|
|
|
|
|
|
|
|
--disable_warnings
|
|
|
|
DROP TABLE IF EXISTS t1;
|
|
|
|
DROP TRIGGER IF EXISTS tr1;
|
|
|
|
DROP PROCEDURE IF EXISTS p1;
|
|
|
|
--enable_warnings
|
|
|
|
|
|
|
|
CREATE TABLE t1 (f1 INTEGER);
|
|
|
|
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET @aux = 1;
|
|
|
|
CREATE PROCEDURE p1 () DROP TRIGGER tr1;
|
|
|
|
|
|
|
|
CALL p1 ();
|
|
|
|
--error ER_TRG_DOES_NOT_EXIST
|
|
|
|
CALL p1 ();
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
DROP PROCEDURE p1;
|
2009-10-26 10:55:57 +01:00
|
|
|
|
2010-02-13 11:35:14 +01:00
|
|
|
--echo #
|
|
|
|
--echo # Bug#50423: Crash on second call of a procedure dropping a trigger
|
|
|
|
--echo #
|
|
|
|
|
|
|
|
--disable_warnings
|
|
|
|
DROP TABLE IF EXISTS t1;
|
|
|
|
DROP TRIGGER IF EXISTS tr1;
|
|
|
|
DROP PROCEDURE IF EXISTS p1;
|
|
|
|
--enable_warnings
|
|
|
|
|
|
|
|
CREATE TABLE t1 (f1 INTEGER);
|
|
|
|
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET @aux = 1;
|
|
|
|
CREATE PROCEDURE p1 () DROP TRIGGER tr1;
|
|
|
|
|
|
|
|
CALL p1 ();
|
|
|
|
--error ER_TRG_DOES_NOT_EXIST
|
|
|
|
CALL p1 ();
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
DROP PROCEDURE p1;
|
|
|
|
|
2009-10-26 10:55:57 +01:00
|
|
|
--echo End of 5.1 tests
|