summaryrefslogtreecommitdiff
path: root/mysql-test/main
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/main')
-rw-r--r--mysql-test/main/errors.result4
-rw-r--r--mysql-test/main/errors.test2
-rw-r--r--mysql-test/main/sp-bugs.result4
-rw-r--r--mysql-test/main/sp-lock.result8
-rw-r--r--mysql-test/main/sp-lock.test3
-rw-r--r--mysql-test/main/sp.result22
-rw-r--r--mysql-test/main/sp.test17
-rw-r--r--mysql-test/main/view.result43
-rw-r--r--mysql-test/main/view.test49
9 files changed, 137 insertions, 15 deletions
diff --git a/mysql-test/main/errors.result b/mysql-test/main/errors.result
index 44193865493..baa2e0ad3c0 100644
--- a/mysql-test/main/errors.result
+++ b/mysql-test/main/errors.result
@@ -224,10 +224,10 @@ SELECT 4;
END IF ;
END"where name = "P1";
show create procedure P1;
-ERROR HY000: Failed to load routine test.P1 (internal code -6). For more details, run SHOW WARNINGS
+ERROR 42000: Undeclared variable: foo
show warnings;
Level Code Message
Error 1327 Undeclared variable: foo
-Error 1457 Failed to load routine test.P1 (internal code -6). For more details, run SHOW WARNINGS
+Error 1305 PROCEDURE P1 does not exist
drop procedure P1;
# End of 10.4 tests
diff --git a/mysql-test/main/errors.test b/mysql-test/main/errors.test
index a4b95d48e5d..1948eebfcb3 100644
--- a/mysql-test/main/errors.test
+++ b/mysql-test/main/errors.test
@@ -275,7 +275,7 @@ SELECT 4;
END IF ;
END"where name = "P1";
---error ER_SP_PROC_TABLE_CORRUPT
+--error ER_SP_UNDECLARED_VAR
show create procedure P1;
show warnings;
diff --git a/mysql-test/main/sp-bugs.result b/mysql-test/main/sp-bugs.result
index 665e787442d..8c6788d03f4 100644
--- a/mysql-test/main/sp-bugs.result
+++ b/mysql-test/main/sp-bugs.result
@@ -168,7 +168,7 @@ RETURN 0;
END latin1 latin1_swedish_ci latin1_swedish_ci
SHOW CREATE FUNCTION TESTF_bug11763507;
Function sql_mode Create Function character_set_client collation_connection Database Collation
-testf_bug11763507 CREATE DEFINER=`root`@`localhost` FUNCTION `testf_bug11763507`() RETURNS int(11)
+TESTF_bug11763507 CREATE DEFINER=`root`@`localhost` FUNCTION `TESTF_bug11763507`() RETURNS int(11)
BEGIN
RETURN 0;
END latin1 latin1_swedish_ci latin1_swedish_ci
@@ -198,7 +198,7 @@ SELECT "PROCEDURE testp_bug11763507";
END latin1 latin1_swedish_ci latin1_swedish_ci
SHOW CREATE PROCEDURE TESTP_bug11763507;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-testp_bug11763507 CREATE DEFINER=`root`@`localhost` PROCEDURE `testp_bug11763507`()
+TESTP_bug11763507 CREATE DEFINER=`root`@`localhost` PROCEDURE `TESTP_bug11763507`()
BEGIN
SELECT "PROCEDURE testp_bug11763507";
END latin1 latin1_swedish_ci latin1_swedish_ci
diff --git a/mysql-test/main/sp-lock.result b/mysql-test/main/sp-lock.result
index acf951f6676..ec8d8970ae3 100644
--- a/mysql-test/main/sp-lock.result
+++ b/mysql-test/main/sp-lock.result
@@ -703,9 +703,6 @@ connection default;
#
# SHOW CREATE PROCEDURE p1 called from p1, after p1 was altered
#
-# We are just covering the existing behaviour with tests. The
-# results are not necessarily correct."
-#
CREATE PROCEDURE p1()
BEGIN
SELECT get_lock("test", 10);
@@ -736,10 +733,7 @@ get_lock("test", 10)
1
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
p1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
-BEGIN
-SELECT get_lock("test", 10);
-SHOW CREATE PROCEDURE p1;
-END latin1 latin1_swedish_ci latin1_swedish_ci
+BEGIN END latin1 latin1_swedish_ci latin1_swedish_ci
connection con3;
disconnect con3;
connection con2;
diff --git a/mysql-test/main/sp-lock.test b/mysql-test/main/sp-lock.test
index 83ea07d4bda..703c59e8f28 100644
--- a/mysql-test/main/sp-lock.test
+++ b/mysql-test/main/sp-lock.test
@@ -807,9 +807,6 @@ connection default;
--echo #
--echo # SHOW CREATE PROCEDURE p1 called from p1, after p1 was altered
--echo #
---echo # We are just covering the existing behaviour with tests. The
---echo # results are not necessarily correct."
---echo #
delimiter |;
CREATE PROCEDURE p1()
diff --git a/mysql-test/main/sp.result b/mysql-test/main/sp.result
index 35ec5fc628f..e30226a47e0 100644
--- a/mysql-test/main/sp.result
+++ b/mysql-test/main/sp.result
@@ -8874,6 +8874,28 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
BEGIN
RETURN '';
END' at line 2
+SELECT VARIABLE_VALUE into @global_mem_used FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='MEMORY_USED';
+SELECT VARIABLE_VALUE into @local_mem_used FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='MEMORY_USED';
+CREATE PROCEDURE sp0() SELECT 1;
+SHOW CREATE PROCEDURE sp0;
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+sp0 STRICT_ALL_TABLES CREATE DEFINER=`root`@`localhost` PROCEDURE `sp0`()
+SELECT 1 latin1 latin1_swedish_ci latin1_swedish_ci
+DROP PROCEDURE sp0;
+SELECT VARIABLE_VALUE into @global_mem_used FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='MEMORY_USED';
+SELECT VARIABLE_VALUE into @local_mem_used FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='MEMORY_USED';
+CREATE PROCEDURE sp1() SELECT 1;
+SHOW CREATE PROCEDURE sp1;
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+sp1 STRICT_ALL_TABLES CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`()
+SELECT 1 latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT VARIABLE_VALUE-@local_mem_used FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='MEMORY_USED';
+VARIABLE_VALUE-@local_mem_used
+0
+SELECT VARIABLE_VALUE-@global_mem_used FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='MEMORY_USED';
+VARIABLE_VALUE-@global_mem_used
+0
+DROP PROCEDURE sp1;
# End of 10.3 tests
#
# Start of 10.4 tests
diff --git a/mysql-test/main/sp.test b/mysql-test/main/sp.test
index c9528c1ccb9..283289d7a93 100644
--- a/mysql-test/main/sp.test
+++ b/mysql-test/main/sp.test
@@ -10418,6 +10418,23 @@ END;
$$
DELIMITER ;$$
+# MDEV-20699 do not cache SP in SHOW CREATE
+# Warmup round, this might allocate some memory for session variable
+# and the output
+SELECT VARIABLE_VALUE into @global_mem_used FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='MEMORY_USED';
+SELECT VARIABLE_VALUE into @local_mem_used FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='MEMORY_USED';
+CREATE PROCEDURE sp0() SELECT 1;
+SHOW CREATE PROCEDURE sp0;
+DROP PROCEDURE sp0;
+
+#Check that CREATE/SHOW does not use memory in caches.
+SELECT VARIABLE_VALUE into @global_mem_used FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='MEMORY_USED';
+SELECT VARIABLE_VALUE into @local_mem_used FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='MEMORY_USED';
+CREATE PROCEDURE sp1() SELECT 1;
+SHOW CREATE PROCEDURE sp1;
+SELECT VARIABLE_VALUE-@local_mem_used FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='MEMORY_USED';
+SELECT VARIABLE_VALUE-@global_mem_used FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='MEMORY_USED';
+DROP PROCEDURE sp1;
--echo # End of 10.3 tests
diff --git a/mysql-test/main/view.result b/mysql-test/main/view.result
index de4be4efda5..946c19f6c24 100644
--- a/mysql-test/main/view.result
+++ b/mysql-test/main/view.result
@@ -6789,6 +6789,49 @@ sum(z)
DROP TABLE t1;
DROP VIEW v1;
#
+# MDEV-24454: Crash at change_item_tree
+#
+CREATE TABLE t1(f0 INT);
+CREATE VIEW v1 AS
+SELECT
+f0 AS f1
+FROM t1;
+CREATE VIEW v2 AS
+SELECT
+(SELECT GROUP_CONCAT(v1.f1 SEPARATOR ', ')
+FROM v1 n) AS f2,
+GROUP_CONCAT('' SEPARATOR ', ') AS f3
+FROM v1;
+CREATE VIEW v3 AS
+SELECT 1 as f4 FROM v2;
+CREATE PROCEDURE p1()
+SELECT * FROM v3;
+CALL p1();
+f4
+1
+CALL p1();
+f4
+1
+drop procedure p1;
+drop view v1,v2,v3;
+drop table t1;
+#
+# MDEV-25631: Crash in st_select_lex::mark_as_dependent with
+# VIEW, aggregate and subquery
+#
+CREATE TABLE t1 (i1 int);
+insert into t1 values (1),(2),(3);
+CREATE VIEW v1 AS
+SELECT t1.i1 FROM (t1 a JOIN t1 ON (t1.i1 = (SELECT t1.i1 FROM t1 b)));
+SELECT 1 FROM (SELECT count(((SELECT i1 FROM v1))) FROM v1) dt ;
+ERROR 21000: Subquery returns more than 1 row
+delete from t1 where i1 > 1;
+SELECT 1 FROM (SELECT count(((SELECT i1 FROM v1))) FROM v1) dt ;
+1
+1
+drop view v1;
+drop table t1;
+#
# End of 10.2 tests
#
#
diff --git a/mysql-test/main/view.test b/mysql-test/main/view.test
index ca5456930ba..ef985d69af6 100644
--- a/mysql-test/main/view.test
+++ b/mysql-test/main/view.test
@@ -6501,6 +6501,55 @@ DROP TABLE t1;
DROP VIEW v1;
--echo #
+--echo # MDEV-24454: Crash at change_item_tree
+--echo #
+
+CREATE TABLE t1(f0 INT);
+
+CREATE VIEW v1 AS
+SELECT
+ f0 AS f1
+FROM t1;
+
+CREATE VIEW v2 AS
+SELECT
+ (SELECT GROUP_CONCAT(v1.f1 SEPARATOR ', ')
+ FROM v1 n) AS f2,
+ GROUP_CONCAT('' SEPARATOR ', ') AS f3
+FROM v1;
+
+CREATE VIEW v3 AS
+SELECT 1 as f4 FROM v2;
+
+CREATE PROCEDURE p1()
+ SELECT * FROM v3;
+
+CALL p1();
+CALL p1();
+
+drop procedure p1;
+drop view v1,v2,v3;
+drop table t1;
+
+--echo #
+--echo # MDEV-25631: Crash in st_select_lex::mark_as_dependent with
+--echo # VIEW, aggregate and subquery
+--echo #
+
+CREATE TABLE t1 (i1 int);
+insert into t1 values (1),(2),(3); #not important
+CREATE VIEW v1 AS
+ SELECT t1.i1 FROM (t1 a JOIN t1 ON (t1.i1 = (SELECT t1.i1 FROM t1 b)));
+
+--error ER_SUBQUERY_NO_1_ROW
+SELECT 1 FROM (SELECT count(((SELECT i1 FROM v1))) FROM v1) dt ;
+delete from t1 where i1 > 1;
+SELECT 1 FROM (SELECT count(((SELECT i1 FROM v1))) FROM v1) dt ;
+
+drop view v1;
+drop table t1;
+
+--echo #
--echo # End of 10.2 tests
--echo #