mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 14:54:20 +01:00
ff5349bd6c
Item_ident fixed to allow double cleanup().
32 lines
638 B
Text
32 lines
638 B
Text
drop table if exists t1,t2;
|
|
drop procedure if exists p1;
|
|
#
|
|
#MDEV-6985: MariaDB crashes on stored procedure call
|
|
#
|
|
CREATE TABLE `t1` (
|
|
`ID` int(11) NOT NULL,
|
|
PRIMARY KEY (`ID`)
|
|
) ENGINE=InnoDB;
|
|
CREATE TABLE `t2` (
|
|
`ID` int(11) NOT NULL,
|
|
`DATE` datetime DEFAULT NULL,
|
|
PRIMARY KEY (`ID`)
|
|
) ENGINE=InnoDB;
|
|
CREATE PROCEDURE `p1`()
|
|
BEGIN
|
|
DECLARE _mySelect CURSOR FOR
|
|
SELECT DISTINCT t1.ID
|
|
FROM t1
|
|
LEFT JOIN t2 AS t2 ON
|
|
t2.ID = t1.ID
|
|
AND t2.DATE = (
|
|
SELECT MAX(T3.DATE) FROM t2 AS T3 WHERE T3.ID = t2.ID AND T3.DATE<=NOW()
|
|
)
|
|
WHERE t1.ID = 1;
|
|
OPEN _mySelect;
|
|
CLOSE _mySelect;
|
|
END ;;
|
|
CALL p1();
|
|
CALL p1();
|
|
drop procedure p1;
|
|
drop table t1,t2;
|