1
--source include/have_innodb.inc
2
--source include/big_test.inc
4
if (`select plugin_auth_version <= "5.5.40-MariaDB-36.1" from information_schema.plugins where plugin_name='innodb'`)
6
--skip Not fixed in XtraDB as of 5.5.40-MariaDB-36.1 or earlier
10
--echo # Bug #19306524 FAILING ASSERTION WITH TEMP TABLE FOR A PROCEDURE
11
--echo # CALLED FROM A FUNCTION
14
call mtr.add_suppression("MySQL is trying to drop table");
17
CREATE PROCEDURE cachedata(
18
IN obj_id BIGINT UNSIGNED,
24
DECLARE cache_count BIGINT;
26
SET @timestamp := NOW();
28
CREATE TEMPORARY TABLE IF NOT EXISTS cachedata (
30
object_id BIGINT UNSIGNED NOT NULL,
33
seqno BIGINT AUTO_INCREMENT,
37
INDEX (object_id, start, end)
40
DELETE FROM cachedata WHERE
41
timestamp < DATE_SUB(@timestamp, INTERVAL 15 SECOND);
43
SELECT count(*) INTO cache_count FROM cachedata WHERE
48
IF cache_count > 0 THEN LEAVE cachedata;
51
INSERT INTO cachedata (timestamp, object_id, start, end, value) VALUES
52
(@timestamp, obj_id, start, end, 1234),
53
(@timestamp, obj_id, start, end, 4567),
54
(@timestamp, obj_id, start, end, 8901),
55
(@timestamp, obj_id, start, end, 1234),
56
(@timestamp, obj_id, start, end, 4567),
57
(@timestamp, obj_id, start, end, 8901),
58
(@timestamp, obj_id, start, end, 1234),
59
(@timestamp, obj_id, start, end, 4567),
60
(@timestamp, obj_id, start, end, 8901),
61
(@timestamp, obj_id, start, end, 1234),
62
(@timestamp, obj_id, start, end, 4567),
63
(@timestamp, obj_id, start, end, 8901),
64
(@timestamp, obj_id, start, end, 2345),
65
(@timestamp, obj_id, start, end, 1234),
66
(@timestamp, obj_id, start, end, 4567),
67
(@timestamp, obj_id, start, end, 8901),
68
(@timestamp, obj_id, start, end, 2345),
69
(@timestamp, obj_id, start, end, 1234),
70
(@timestamp, obj_id, start, end, 4567),
71
(@timestamp, obj_id, start, end, 8901),
72
(@timestamp, obj_id, start, end, 2345);
77
CREATE FUNCTION get_cache(
78
obj_id BIGINT UNSIGNED,
87
CALL cachedata(obj_id, start, end);
89
SELECT SUM(value) INTO result FROM cachedata WHERE
102
SELECT get_cache(1, '2014-01-01', '2014-02-01');
107
DROP FUNCTION get_cache;
108
DROP PROCEDURE cachedata;