mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
07c30f911e
This bug is just one facet of stored routines not being able to detect changes in meta-data (WL#4179). This particular problem can be triggered within a single session due to the improper management of the pre-locking list if the view is expanded after the pre-locking list is calculated. Since the overall solution for the meta-data detection issue is planned for a later release, for now a workaround is used to fix this particular aspect that only involves a single session. The workaround is to flush the thread-local stored routine cache every time a view is created or modified, causing locally cached routines to be re-evaluated upon invocation. mysql-test/r/sp-bugs.result: Add test case result for Bug#50624. mysql-test/t/sp-bugs.test: Add test case for Bug#50624. sql/sp_cache.cc: Update function description. sql/sql_view.cc: Invalidate the SP cache if a view is being created or modified.
104 lines
2.1 KiB
Text
104 lines
2.1 KiB
Text
# 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;
|
|
|
|
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;
|
|
|
|
--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;
|
|
|
|
--echo End of 5.1 tests
|