mariadb/mysql-test/main/ps_mem_leaks.result
2024-08-20 11:29:44 +02:00

193 lines
4.7 KiB
Text

#
# MDEV-32369: Memory leak when executing PS for query with IN subquery
#
CREATE TABLE t1 (a VARCHAR(10)) ENGINE=MYISAM;
CREATE TABLE t2 (b VARCHAR(10) CHARACTER SET utf8) ENGINE=MYISAM;
INSERT INTO t1 VALUES ('b'), ('a'), ('c');
INSERT INTO t2 VALUES ('c'), ('d'), ('b');
PREPARE stmt FROM "SELECT t1.a FROM t1 WHERE t1.a IN (SELECT t2.b FROM t2)";
EXECUTE stmt;
a
c
b
EXECUTE stmt;
a
c
b
DEALLOCATE PREPARE stmt;
DELETE FROM t1;
DELETE FROM t2;
INSERT INTO t1 VALUES ('b');
INSERT INTO t2 VALUES ('b');
PREPARE stmt FROM "SELECT t1.a FROM t1 WHERE t1.a IN (SELECT t2.b FROM t2)";
EXECUTE stmt;
a
b
EXECUTE stmt;
a
b
DEALLOCATE PREPARE stmt;
DROP TABLE t1, t2;
#
# MDEV-32569: Failure when executing PS for query using IN subquery
#
CREATE TABLE t1 (a varchar(10)) ENGINE=MYISAM;
CREATE TABLE t2 (b varchar(10) CHARACTER SET utf8) ENGINE=MYISAM;
INSERT INTO t1 VALUES ('b');
INSERT INTO t2 VALUES ('b');
PREPARE stmt FROM
"SELECT STRAIGHT_JOIN t1.a FROM t1 WHERE t1.a IN (SELECT t2.b FROM t2)";
EXECUTE stmt;
a
b
EXECUTE stmt;
a
b
DEALLOCATE PREPARE stmt;
DROP TABLE t1,t2;
#
# MDEV-32733: Two JSON related tests running in PS mode fail on server
# built with -DWITH_PROTECT_STATEMENT_MEMROOT=YES
#
PREPARE stmt FROM "select json_contains_path('{\"key1\":1}', 'oNE', '$.key2[1]') as exp";
EXECUTE stmt;
exp
0
EXECUTE stmt;
exp
0
DEALLOCATE PREPARE stmt;
#
# MDEV-32466: Potential memory leak on execuing of create view statement
#
CREATE FUNCTION f1 () RETURNS VARCHAR(1)
BEGIN
DECLARE rec1 ROW TYPE OF v1;
SELECT z INTO rec1 FROM v1;
RETURN 1;
END|
CREATE FUNCTION f2 () RETURNS VARCHAR(1) RETURN '!';
CREATE VIEW v1 AS SELECT f2() z;
PREPARE stmt FROM "SELECT f1()";
EXECUTE stmt;
f1()
1
EXECUTE stmt;
f1()
1
DEALLOCATE PREPARE stmt;
DROP FUNCTION f1;
DROP VIEW v1;
DROP FUNCTION f2;
#
# MDEV-32867: ASAN errors in Item_func_json_contains_path::val_int upon PS execution
#
CREATE TABLE t1 (f BLOB) ENGINE=MyISAM;
PREPARE stmt FROM "SELECT * FROM t1 WHERE JSON_EXISTS(JSON_ARRAY('[true,1234567890]'), '$**.*') != JSON_CONTAINS_PATH(JSON_INSERT('{}', '$[1]', NULL), 'all', '$[1]')";
EXECUTE stmt;
f
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
# End of 10.4 tests
#
# MDEV-33769: Memory leak found in the test main.rownum run with --ps-protocol against a server built with the option -DWITH_PROTECT_STATEMENT_MEMROOT
#
CREATE OR REPLACE TABLE t1(a INT);
PREPARE stmt FROM 'SELECT 1 FROM t1 WHERE ROWNUM() < 2';
EXECUTE stmt;
1
EXECUTE stmt;
1
INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
PREPARE stmt FROM 'SELECT * FROM t1 WHERE ROWNUM() < ?';
# Expected output is two rows (1), (2)
EXECUTE stmt USING 3;
a
1
2
# Expected output is one row (1)
EXECUTE stmt USING 2;
a
1
# Expected output is three rows (1), (2), (3)
EXECUTE stmt USING 4;
a
1
2
# Clean up
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
# End of 10.6 tests
#
# MDEV-34447: Memory leakage is detected on running the test main.ps against the server 11.1
#
CREATE TABLE t1 (id INT, value INT);
CREATE TABLE t2 (id INT);
PREPARE stmt FROM 'UPDATE t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id)';
EXECUTE stmt;
INSERT INTO t1 VALUES (1,10),(2,10),(3,10);
INSERT INTO t2 VALUES (1),(2);
EXECUTE stmt;
SELECT * FROM t1;
id value
1 1
2 1
3 NULL
DEALLOCATE PREPARE stmt;
DROP TABLE t1, t2;
# Memory leak also could take place on running the DELETE statement
# with the LIMIT clause. Check it.
CREATE TABLE t1 (c1 INT);
INSERT INTO t1 (c1) VALUES (1), (2), (3);
CREATE PROCEDURE p1(p1 INT)
DELETE FROM t1 LIMIT p1;
CALL p1(0);
CALL p1(1);
CALL p1(2);
# Clean up
DROP TABLE t1;
DROP PROCEDURE p1;
# End of 10.11 tests
#
# MDEV-34649: Memory leaks on running DELETE statement in PS mode with positional parameters
#
CREATE TABLE t1 (a INT, b VARCHAR(30)) CHARSET=utf8mb4;
INSERT INTO t1 VALUES (1, 'one'), (0, NULL), (3, 'three'), (4, 'four');
PREPARE stmt FROM 'DELETE FROM t1 WHERE b=?' ;
SET @arg00=NULL;
EXECUTE stmt USING @arg00;
SET @arg00='one';
EXECUTE stmt USING @arg00;
# Clean up
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
# End of 11.1
#
# MDEV-34517: Memory leak on re-compilation of a failing statement inside a stored routine
#
CREATE TABLE t1 (a INT);
CREATE PROCEDURE p1()
SELECT * FROM t1;
SET @save_dbug = @@debug_dbug;
CALL p1();
a
DROP TABLE t1;
CREATE TABLE t1 (a INT);
SET @@debug_dbug='+d,check_sp_cache_not_invalidated,sp_instr_reparsing_1st_time';
# Recomplilation of the statement 'SELECT * FORM t1' on
# the second run of the procedure p1 shouldn't result in memory leaks
CALL p1();
a
SET @@debug_dbug='-d,sp_instr_reparsing_1st_time';
DROP TABLE t1;
CREATE TABLE t1 (a INT);
# Recompilation is requested the second time
SET @@debug_dbug='+d,sp_instr_reparsing_2nd_time';
CALL p1();
a
SET @@debug_dbug='-d,sp_instr_reparsing_2nd_time';
# Clean up
SET @@debug_dbug=@save_dbug;
DROP TABLE t1;
DROP PROCEDURE p1;
# End of 11.2 tests