2023-10-18 11:15:16 +07:00
|
|
|
#
|
|
|
|
# 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;
|
2023-10-31 09:59:39 -07:00
|
|
|
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;
|
2023-10-18 11:15:16 +07:00
|
|
|
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;
|
2023-10-31 09:59:39 -07:00
|
|
|
#
|
|
|
|
# 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;
|
2023-11-10 17:46:19 +07:00
|
|
|
#
|
|
|
|
# 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;
|
2023-11-24 16:26:12 +07:00
|
|
|
#
|
|
|
|
# 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;
|
2023-11-24 20:39:12 +07:00
|
|
|
#
|
|
|
|
# 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;
|
2023-10-31 09:59:39 -07:00
|
|
|
# End of 10.4 tests
|
2024-05-06 20:10:06 +07:00
|
|
|
#
|
|
|
|
# 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
|