summaryrefslogtreecommitdiff
path: root/mysql-test/main
diff options
context:
space:
mode:
authorNikita Malyavin <nikitamalyavin@gmail.com>2021-05-05 23:03:01 +0300
committerNikita Malyavin <nikitamalyavin@gmail.com>2021-05-05 23:03:01 +0300
commit509e4990af4d99e9d3c790eabe1c1705ae910b55 (patch)
tree02d4ca9409711baef3ec163adc402f2c380df7c8 /mysql-test/main
parent0cc811c633d1fe5290b10fa49fad0a4b889383fa (diff)
parent4f143a88bcb36e94e9edba8a3c5b4a350dcd9bf9 (diff)
downloadmariadb-git-509e4990af4d99e9d3c790eabe1c1705ae910b55.tar.gz
Merge branch bb-10.3-release into bb-10.4-release
Diffstat (limited to 'mysql-test/main')
-rw-r--r--mysql-test/main/derived_split_innodb.result34
-rw-r--r--mysql-test/main/derived_split_innodb.test26
-rw-r--r--mysql-test/main/lowercase_table.result47
-rw-r--r--mysql-test/main/lowercase_table.test69
-rw-r--r--mysql-test/main/mdev19198.result15
-rw-r--r--mysql-test/main/mdev19198.test15
-rw-r--r--mysql-test/main/plugin_vars.result35
-rw-r--r--mysql-test/main/plugin_vars.test35
-rw-r--r--mysql-test/main/show.result32
-rw-r--r--mysql-test/main/show.test34
-rw-r--r--mysql-test/main/show_explain.opt1
-rw-r--r--mysql-test/main/show_explain.test9
-rw-r--r--mysql-test/main/sp-bugs.result27
-rw-r--r--mysql-test/main/sp-bugs.test23
-rw-r--r--mysql-test/main/sp.result15
-rw-r--r--mysql-test/main/sp.test19
-rw-r--r--mysql-test/main/udf.result9
-rw-r--r--mysql-test/main/udf.test10
18 files changed, 410 insertions, 45 deletions
diff --git a/mysql-test/main/derived_split_innodb.result b/mysql-test/main/derived_split_innodb.result
index e8f9df5f80d..ff71b7df097 100644
--- a/mysql-test/main/derived_split_innodb.result
+++ b/mysql-test/main/derived_split_innodb.result
@@ -141,3 +141,37 @@ id select_type table type possible_keys key key_len ref rows Extra
3 DERIVED t2 index NULL PRIMARY 4 NULL 3
drop view v1;
drop table t1,t2;
+#
+# MDEV-23723: Crash when test_if_skip_sort_order() is checked for derived table subject to split
+#
+CREATE TABLE t1 (a INT, b INT, KEY (a), KEY (a,b)) ENGINE=InnoDB;
+CREATE TABLE t2 (c INT, KEY (c)) ENGINE=InnoDB;
+SELECT * FROM t1 t1a JOIN t1 t1b;
+a b a b
+INSERT INTO t2 VALUES (1),(2);
+INSERT INTO t1 VALUES (1,2),(3,4),(5,6),(7,8),(9,10),(11,12);
+set statement optimizer_switch='split_materialized=off' for EXPLAIN
+SELECT *
+FROM
+t1 JOIN
+(SELECT t1.a, t1.b FROM t1, t2 WHERE t1.b = t2.c GROUP BY t1.a, t1.b) as dt
+WHERE
+t1.a = dt.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 index a,a_2 a_2 10 NULL 6 Using where; Using index
+1 PRIMARY <derived3> ref key0 key0 5 test.t1.a 2
+3 DERIVED t1 index NULL a_2 10 NULL 6 Using where; Using index
+3 DERIVED t2 ref c c 5 test.t1.b 1 Using index
+set statement optimizer_switch='split_materialized=on' for EXPLAIN
+SELECT *
+FROM
+t1 JOIN
+(SELECT t1.a, t1.b FROM t1, t2 WHERE t1.b = t2.c GROUP BY t1.a, t1.b) as dt
+WHERE
+t1.a = dt.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 index a,a_2 a_2 10 NULL 6 Using where; Using index
+1 PRIMARY <derived3> ref key0 key0 5 test.t1.a 2
+3 LATERAL DERIVED t1 ref a,a_2 a 5 test.t1.a 1 Using where; Using temporary; Using filesort
+3 LATERAL DERIVED t2 ref c c 5 test.t1.b 1 Using index
+DROP TABLE t1, t2;
diff --git a/mysql-test/main/derived_split_innodb.test b/mysql-test/main/derived_split_innodb.test
index 4f9d2e970f7..19a6ecf216f 100644
--- a/mysql-test/main/derived_split_innodb.test
+++ b/mysql-test/main/derived_split_innodb.test
@@ -124,3 +124,29 @@ eval set statement optimizer_switch='split_materialized=off' for explain $q;
drop view v1;
drop table t1,t2;
+
+--echo #
+--echo # MDEV-23723: Crash when test_if_skip_sort_order() is checked for derived table subject to split
+--echo #
+CREATE TABLE t1 (a INT, b INT, KEY (a), KEY (a,b)) ENGINE=InnoDB;
+CREATE TABLE t2 (c INT, KEY (c)) ENGINE=InnoDB;
+
+SELECT * FROM t1 t1a JOIN t1 t1b;
+
+INSERT INTO t2 VALUES (1),(2);
+INSERT INTO t1 VALUES (1,2),(3,4),(5,6),(7,8),(9,10),(11,12);
+
+let $query=
+EXPLAIN
+SELECT *
+FROM
+ t1 JOIN
+ (SELECT t1.a, t1.b FROM t1, t2 WHERE t1.b = t2.c GROUP BY t1.a, t1.b) as dt
+WHERE
+ t1.a = dt.a;
+
+eval set statement optimizer_switch='split_materialized=off' for $query;
+eval set statement optimizer_switch='split_materialized=on' for $query;
+
+DROP TABLE t1, t2;
+
diff --git a/mysql-test/main/lowercase_table.result b/mysql-test/main/lowercase_table.result
index 823ffa7696f..3d840445bf2 100644
--- a/mysql-test/main/lowercase_table.result
+++ b/mysql-test/main/lowercase_table.result
@@ -1,7 +1,3 @@
-drop table if exists t1,t2,t3,t4;
-drop table if exists t0,t5,t6,t7,t8,t9;
-drop database if exists mysqltest;
-drop view if exists v0, v1, v2, v3, v4;
create table T1 (id int primary key, Word varchar(40) not null, Index(Word));
create table t4 (id int primary key, Word varchar(40) not null);
INSERT INTO T1 VALUES (1, 'a'), (2, 'b'), (3, 'c');
@@ -79,13 +75,21 @@ ERROR 42000: Not unique table/alias: 'C'
select C.a, c.a from t1 c, t2 C;
ERROR 42000: Not unique table/alias: 'C'
drop table t1, t2;
+#
+# Bug #9761: CREATE TABLE ... LIKE ... not handled correctly when lower_case_table_names is set
+#
create table t1 (a int);
create table t2 like T1;
drop table t1, t2;
show tables;
Tables_in_test
+#
+# End of 4.1 tests
+#
+#
+# Bug#20404: SHOW CREATE TABLE fails with Turkish I
+#
set names utf8;
-drop table if exists İ,İİ;
create table İ (s1 int);
show create table İ;
Table Create Table
@@ -107,7 +111,12 @@ Tables_in_test
ii
drop table İİ;
set names latin1;
-End of 5.0 tests
+#
+# End of 5.0 tests
+#
+#
+# Bug#21317: SHOW CREATE DATABASE does not obey to lower_case_table_names
+#
create database mysql_TEST character set latin2;
create table mysql_TEST.T1 (a int);
show create database mysql_TEST;
@@ -126,8 +135,32 @@ show databases like "mysql_TE%";
Database (mysql_TE%)
mysql_test
drop database mysql_TEST;
-End of 10.0 tests
+#
+# End of 10.0 tests
+#
+#
+# MDEV-17148 DROP DATABASE throw "Directory not empty" after changed lower_case_table_names.
+#
create database db1;
create table t1 (a int);
drop database db1;
drop table t1;
+#
+# End of 10.2 tests
+#
+#
+# MDEV-25109 Server crashes in sp_name::sp_name upon invalid data in mysql.proc
+#
+call mtr.add_suppression("Stored routine ''.'': invalid value in column");
+insert ignore into mysql.proc () values ();
+Warnings:
+Warning 1364 Field 'param_list' doesn't have a default value
+Warning 1364 Field 'returns' doesn't have a default value
+Warning 1364 Field 'body' doesn't have a default value
+Warning 1364 Field 'comment' doesn't have a default value
+show function status;
+ERROR 42000: Incorrect routine name ''
+delete from mysql.proc where name = '';
+#
+# End of 10.3 tests
+#
diff --git a/mysql-test/main/lowercase_table.test b/mysql-test/main/lowercase_table.test
index e0dcb6c36dd..4f92e43f5f7 100644
--- a/mysql-test/main/lowercase_table.test
+++ b/mysql-test/main/lowercase_table.test
@@ -2,14 +2,6 @@
# Test of --lower-case-table-names
#
---disable_warnings
-drop table if exists t1,t2,t3,t4;
-# Clear up from other tests (to ensure that SHOW TABLES below is right)
-drop table if exists t0,t5,t6,t7,t8,t9;
-drop database if exists mysqltest;
-drop view if exists v0, v1, v2, v3, v4;
---enable_warnings
-
create table T1 (id int primary key, Word varchar(40) not null, Index(Word));
create table t4 (id int primary key, Word varchar(40) not null);
INSERT INTO T1 VALUES (1, 'a'), (2, 'b'), (3, 'c');
@@ -68,32 +60,29 @@ drop table t1,t2;
#
create table t1 (a int);
create table t2 (a int);
--- error 1066
+--error ER_NONUNIQ_TABLE
select * from t1 c, t2 C;
--- error 1066
+--error ER_NONUNIQ_TABLE
select C.a, c.a from t1 c, t2 C;
drop table t1, t2;
-#
-# Bug #9761: CREATE TABLE ... LIKE ... not handled correctly when
-# lower_case_table_names is set
+--echo #
+--echo # Bug #9761: CREATE TABLE ... LIKE ... not handled correctly when lower_case_table_names is set
+--echo #
create table t1 (a int);
create table t2 like T1;
drop table t1, t2;
show tables;
+--echo #
+--echo # End of 4.1 tests
+--echo #
-# End of 4.1 tests
-
-
-#
-# Bug#20404: SHOW CREATE TABLE fails with Turkish I
-#
+--echo #
+--echo # Bug#20404: SHOW CREATE TABLE fails with Turkish I
+--echo #
set names utf8;
---disable_warnings
-drop table if exists İ,İİ;
---enable_warnings
create table İ (s1 int);
show create table İ;
show tables;
@@ -104,11 +93,13 @@ show tables;
drop table İİ;
set names latin1;
---echo End of 5.0 tests
+--echo #
+--echo # End of 5.0 tests
+--echo #
-#
-# Bug#21317: SHOW CREATE DATABASE does not obey to lower_case_table_names
-#
+--echo #
+--echo # Bug#21317: SHOW CREATE DATABASE does not obey to lower_case_table_names
+--echo #
create database mysql_TEST character set latin2;
create table mysql_TEST.T1 (a int);
show create database mysql_TEST;
@@ -117,11 +108,13 @@ show databases like "mysql%";
show databases like "mysql_TE%";
drop database mysql_TEST;
---echo End of 10.0 tests
+--echo #
+--echo # End of 10.0 tests
+--echo #
-#
-# MDEV-17148 DROP DATABASE throw "Directory not empty" after changed lower_case_table_names.
-#
+--echo #
+--echo # MDEV-17148 DROP DATABASE throw "Directory not empty" after changed lower_case_table_names.
+--echo #
let $datadir=`select @@datadir`;
create database db1;
@@ -130,3 +123,19 @@ copy_file $datadir/test/t1.frm $datadir/db1/T1.frm;
drop database db1;
drop table t1;
+--echo #
+--echo # End of 10.2 tests
+--echo #
+
+--echo #
+--echo # MDEV-25109 Server crashes in sp_name::sp_name upon invalid data in mysql.proc
+--echo #
+call mtr.add_suppression("Stored routine ''.'': invalid value in column");
+insert ignore into mysql.proc () values ();
+--error ER_SP_WRONG_NAME
+show function status;
+delete from mysql.proc where name = '';
+
+--echo #
+--echo # End of 10.3 tests
+--echo #
diff --git a/mysql-test/main/mdev19198.result b/mysql-test/main/mdev19198.result
new file mode 100644
index 00000000000..77c08ca0fb7
--- /dev/null
+++ b/mysql-test/main/mdev19198.result
@@ -0,0 +1,15 @@
+CREATE TABLE t1 (c INT);
+CREATE TABLE t2 (c INT);
+LOCK TABLES t1 WRITE, t2 READ;
+CREATE TABLE IF NOT EXISTS t1 LIKE t2;
+Warnings:
+Note 1050 Table 't1' already exists
+UNLOCK TABLES;
+LOCK TABLES t1 READ , t2 READ;
+CREATE TABLE IF NOT EXISTS t1 LIKE t2;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+UNLOCK TABLES;
+CREATE TABLE IF NOT EXISTS t1 LIKE t2;
+Warnings:
+Note 1050 Table 't1' already exists
+DROP TABLES t1,t2;
diff --git a/mysql-test/main/mdev19198.test b/mysql-test/main/mdev19198.test
new file mode 100644
index 00000000000..19b45ed7510
--- /dev/null
+++ b/mysql-test/main/mdev19198.test
@@ -0,0 +1,15 @@
+CREATE TABLE t1 (c INT);
+CREATE TABLE t2 (c INT);
+
+LOCK TABLES t1 WRITE, t2 READ;
+CREATE TABLE IF NOT EXISTS t1 LIKE t2;
+UNLOCK TABLES;
+
+LOCK TABLES t1 READ , t2 READ;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+CREATE TABLE IF NOT EXISTS t1 LIKE t2;
+UNLOCK TABLES;
+
+CREATE TABLE IF NOT EXISTS t1 LIKE t2;
+
+DROP TABLES t1,t2;
diff --git a/mysql-test/main/plugin_vars.result b/mysql-test/main/plugin_vars.result
index 0e382427b1d..3fadd5e74fd 100644
--- a/mysql-test/main/plugin_vars.result
+++ b/mysql-test/main/plugin_vars.result
@@ -30,3 +30,38 @@ disconnect con2;
USE test;
DROP PROCEDURE p_install;
DROP PROCEDURE p_show_vars;
+#
+# Bug#29363867: LOST CONNECTION TO MYSQL SERVER DURING QUERY
+#
+## prepared SET with a plugin variable prevents uninstall
+install plugin query_response_time soname 'query_response_time';
+prepare s from 'set global query_response_time_range_base=16';
+select plugin_status from information_schema.plugins where plugin_name='query_response_time';
+plugin_status
+ACTIVE
+uninstall plugin query_response_time;
+Warnings:
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+execute s;
+execute s;
+select plugin_status from information_schema.plugins where plugin_name='query_response_time';
+plugin_status
+DELETED
+deallocate prepare s;
+select plugin_status from information_schema.plugins where plugin_name='query_response_time';
+plugin_status
+## prepared SET mentioning a plugin otherwise does not prevent uninstall
+install plugin archive soname 'ha_archive';
+create table t1 (a int) engine=archive;
+insert t1 values (1),(2),(3);
+prepare s from 'set session auto_increment_increment=(select count(*) from t1)';
+flush tables;
+select plugin_status from information_schema.plugins where plugin_name='archive';
+plugin_status
+ACTIVE
+uninstall plugin archive;
+select plugin_status from information_schema.plugins where plugin_name='archive';
+plugin_status
+execute s;
+ERROR 42000: Unknown storage engine 'ARCHIVE'
+drop table t1;
diff --git a/mysql-test/main/plugin_vars.test b/mysql-test/main/plugin_vars.test
index 8ba8fe2ec0e..797dcbea727 100644
--- a/mysql-test/main/plugin_vars.test
+++ b/mysql-test/main/plugin_vars.test
@@ -1,3 +1,10 @@
+if (!$QUERY_RESPONSE_TIME_SO) {
+ skip Needs query_response_time loadable plugin;
+}
+if (!$HA_ARCHIVE_SO) {
+ skip Needs Archive loadable plugin;
+}
+
--echo #
--echo # MDEV-5345 - Deadlock between mysql_change_user(), SHOW VARIABLES and
--echo # INSTALL PLUGIN
@@ -54,3 +61,31 @@ disconnect con2;
USE test;
DROP PROCEDURE p_install;
DROP PROCEDURE p_show_vars;
+
+--echo #
+--echo # Bug#29363867: LOST CONNECTION TO MYSQL SERVER DURING QUERY
+--echo #
+
+--echo ## prepared SET with a plugin variable prevents uninstall
+install plugin query_response_time soname 'query_response_time';
+prepare s from 'set global query_response_time_range_base=16';
+select plugin_status from information_schema.plugins where plugin_name='query_response_time';
+uninstall plugin query_response_time;
+execute s;
+execute s;
+select plugin_status from information_schema.plugins where plugin_name='query_response_time';
+deallocate prepare s;
+select plugin_status from information_schema.plugins where plugin_name='query_response_time';
+
+--echo ## prepared SET mentioning a plugin otherwise does not prevent uninstall
+install plugin archive soname 'ha_archive';
+create table t1 (a int) engine=archive;
+insert t1 values (1),(2),(3);
+prepare s from 'set session auto_increment_increment=(select count(*) from t1)';
+flush tables;
+select plugin_status from information_schema.plugins where plugin_name='archive';
+uninstall plugin archive;
+select plugin_status from information_schema.plugins where plugin_name='archive';
+--error ER_UNKNOWN_STORAGE_ENGINE
+execute s;
+drop table t1;
diff --git a/mysql-test/main/show.result b/mysql-test/main/show.result
index 3dd7af5de05..d1b373d8969 100644
--- a/mysql-test/main/show.result
+++ b/mysql-test/main/show.result
@@ -1,3 +1,8 @@
+#
+# MDEV-9538 Server crashes in check_show_access on SHOW STATISTICS
+# MDEV-9539 Server crashes in make_columns_old_format on SHOW GEOMETRY_COLUMNS
+# MDEV-9540 SHOW SPATIAL_REF_SYS and SHOW SYSTEM_VARIABLES return empty results with numerous warnings
+#
show statistics;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'statistics' at line 1
show spatial_ref_sys
@@ -10,3 +15,30 @@ show geometry_columns;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'geometry_columns' at line 1
show nonexistent;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'nonexistent' at line 1
+#
+# MDEV-21603 Crashing SHOW TABLES with derived table in WHERE condition
+#
+create table t1 (nm varchar(32), a int);
+insert t1 values ('1',1),('2',2),('3',3);
+show tables
+where tables_in_test in (select *
+from (select nm from test.t1 group by nm) dt);
+Tables_in_test
+show fields from test.t1
+where field in (select * from (select nm from test.t1 group by nm) dt);
+Field Type Null Key Default Extra
+insert t1 values ('nm',0);
+show fields from test.t1
+where field in (select * from (select nm from test.t1 group by nm) dt);
+Field Type Null Key Default Extra
+nm varchar(32) YES NULL
+show fields from test.t1 where field in
+(select * from (select column_name from information_schema.columns
+where table_name='t1' group by column_name) dt);
+Field Type Null Key Default Extra
+nm varchar(32) YES NULL
+a int(11) YES NULL
+drop table t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/main/show.test b/mysql-test/main/show.test
index 3101f443264..f2f6efc4e45 100644
--- a/mysql-test/main/show.test
+++ b/mysql-test/main/show.test
@@ -1,8 +1,8 @@
-#
-# MDEV-9538 Server crashes in check_show_access on SHOW STATISTICS
-# MDEV-9539 Server crashes in make_columns_old_format on SHOW GEOMETRY_COLUMNS
-# MDEV-9540 SHOW SPATIAL_REF_SYS and SHOW SYSTEM_VARIABLES return empty results with numerous warnings
-#
+--echo #
+--echo # MDEV-9538 Server crashes in check_show_access on SHOW STATISTICS
+--echo # MDEV-9539 Server crashes in make_columns_old_format on SHOW GEOMETRY_COLUMNS
+--echo # MDEV-9540 SHOW SPATIAL_REF_SYS and SHOW SYSTEM_VARIABLES return empty results with numerous warnings
+--echo #
--error ER_PARSE_ERROR
show statistics;
--error ER_PARSE_ERROR
@@ -13,3 +13,27 @@ show system_variables;
show geometry_columns;
--error ER_PARSE_ERROR
show nonexistent;
+
+--echo #
+--echo # MDEV-21603 Crashing SHOW TABLES with derived table in WHERE condition
+--echo #
+create table t1 (nm varchar(32), a int);
+insert t1 values ('1',1),('2',2),('3',3);
+
+show tables
+ where tables_in_test in (select *
+ from (select nm from test.t1 group by nm) dt);
+show fields from test.t1
+ where field in (select * from (select nm from test.t1 group by nm) dt);
+insert t1 values ('nm',0);
+show fields from test.t1
+ where field in (select * from (select nm from test.t1 group by nm) dt);
+
+show fields from test.t1 where field in
+ (select * from (select column_name from information_schema.columns
+ where table_name='t1' group by column_name) dt);
+drop table t1;
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
diff --git a/mysql-test/main/show_explain.opt b/mysql-test/main/show_explain.opt
new file mode 100644
index 00000000000..3a3bab51225
--- /dev/null
+++ b/mysql-test/main/show_explain.opt
@@ -0,0 +1 @@
+--enable-plugin-innodb-lock-waits --enable-plugin-innodb-trx
diff --git a/mysql-test/main/show_explain.test b/mysql-test/main/show_explain.test
index 6f49b9cd301..515eb9efa47 100644
--- a/mysql-test/main/show_explain.test
+++ b/mysql-test/main/show_explain.test
@@ -863,7 +863,14 @@ select * from t1 where pk between 10 and 20 for update;
# run SHOW EXPLAIN on a frozen thread
connection default;
let $save_wait_condition= $wait_condition;
-let $wait_condition= select State='Sending data' from information_schema.processlist where id=$thr2;
+let $wait_condition=
+select 1
+from information_schema.INNODB_LOCK_WAITS
+where
+ requesting_trx_id=(select trx_id
+ from information_schema.INNODB_TRX
+ where trx_mysql_thread_id=$thr2);
+
let $thr_default=`select connection_id()`;
--source include/wait_condition.inc
--echo # do: send_eval show explain for thr2;
diff --git a/mysql-test/main/sp-bugs.result b/mysql-test/main/sp-bugs.result
index 0aa9033f477..665e787442d 100644
--- a/mysql-test/main/sp-bugs.result
+++ b/mysql-test/main/sp-bugs.result
@@ -116,7 +116,9 @@ Warnings:
Note 1050 Table 't2' already exists
DROP DATABASE testdb;
USE test;
-End of 5.1 tests
+#
+# End of 5.1 tests
+#
#
# BUG#13489996 valgrind:conditional jump or move depends on
# uninitialised values-field_blob
@@ -328,3 +330,26 @@ FOR i IN 1..10 DO
RETURN 1;
END FOR
DROP FUNCTION f1;
+#
+# End of 10.2 tests
+#
+#
+# MDEV-25501 routine_definition in information_schema.routines loses tablename if it starts with an _ and is not backticked
+#
+create table _t1 (a int);
+create procedure p1() select * from _t1;
+show create procedure p1;
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+select * from _t1 latin1 latin1_swedish_ci latin1_swedish_ci
+select routine_definition from information_schema.routines where routine_schema=database() and specific_name='p1';
+routine_definition
+select * from _t1
+select body, body_utf8 from mysql.proc where name='p1';
+body body_utf8
+select * from _t1 select * from _t1
+drop procedure p1;
+drop table _t1;
+#
+# End of 10.3 tests
+#
diff --git a/mysql-test/main/sp-bugs.test b/mysql-test/main/sp-bugs.test
index f06e9eca690..9b81fd1af61 100644
--- a/mysql-test/main/sp-bugs.test
+++ b/mysql-test/main/sp-bugs.test
@@ -143,7 +143,9 @@ CALL p1();
DROP DATABASE testdb;
USE test;
---echo End of 5.1 tests
+--echo #
+--echo # End of 5.1 tests
+--echo #
--echo #
--echo # BUG#13489996 valgrind:conditional jump or move depends on
@@ -350,3 +352,22 @@ DELIMITER ;$$
SELECT f1();
SELECT body FROM mysql.proc WHERE db='test' AND specific_name='f1';
DROP FUNCTION f1;
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
+
+--echo #
+--echo # MDEV-25501 routine_definition in information_schema.routines loses tablename if it starts with an _ and is not backticked
+--echo #
+create table _t1 (a int);
+create procedure p1() select * from _t1;
+show create procedure p1;
+select routine_definition from information_schema.routines where routine_schema=database() and specific_name='p1';
+select body, body_utf8 from mysql.proc where name='p1';
+drop procedure p1;
+drop table _t1;
+
+--echo #
+--echo # End of 10.3 tests
+--echo #
diff --git a/mysql-test/main/sp.result b/mysql-test/main/sp.result
index 10ba1311f0b..35ec5fc628f 100644
--- a/mysql-test/main/sp.result
+++ b/mysql-test/main/sp.result
@@ -8468,6 +8468,21 @@ ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function
DROP PROCEDURE p1;
DROP VIEW v1;
DROP TABLE t1;
+#
+# BUG#30366310: USING A FUNCTION TO ASSIGN DEFAULT VALUES TO
+# 2 OR MORE VARIABLES CRASHES SERVER
+#
+create function f1() returns bigint return now()-1|
+create procedure p1()
+begin
+declare b, c bigint default f1();
+select b-c;
+end|
+call p1()|
+b-c
+0
+drop procedure p1|
+drop function f1|
#End of 10.2 tests
#
# MDEV-12007 Allow ROW variables as a cursor FETCH target
diff --git a/mysql-test/main/sp.test b/mysql-test/main/sp.test
index bf3a70b6283..c9528c1ccb9 100644
--- a/mysql-test/main/sp.test
+++ b/mysql-test/main/sp.test
@@ -10013,6 +10013,25 @@ DROP PROCEDURE p1;
DROP VIEW v1;
DROP TABLE t1;
+
+--echo #
+--echo # BUG#30366310: USING A FUNCTION TO ASSIGN DEFAULT VALUES TO
+--echo # 2 OR MORE VARIABLES CRASHES SERVER
+--echo #
+
+delimiter |;
+create function f1() returns bigint return now()-1|
+create procedure p1()
+begin
+ declare b, c bigint default f1();
+ select b-c;
+end|
+call p1()|
+drop procedure p1|
+drop function f1|
+delimiter ;|
+
+
--echo #End of 10.2 tests
--echo #
diff --git a/mysql-test/main/udf.result b/mysql-test/main/udf.result
index a6fabf7f137..27bd17e7e31 100644
--- a/mysql-test/main/udf.result
+++ b/mysql-test/main/udf.result
@@ -492,8 +492,17 @@ select * from mysql.plugin WHERE name='unexisting_udf';
name dl
DROP FUNCTION unexisting_udf;
ERROR 42000: FUNCTION test.unexisting_udf does not exist
+#
+# Bug #31674599: THE UDF_INIT() FUNCTION CAUSE SERVER CRASH
+#
+call mtr.add_suppression('Invalid row in mysql.func table');
+insert mysql.func () values ();
+# restart
+delete from mysql.func where name = '';
+#
# End of 10.2 tests
#
+#
# MDEV-15073: Generic UDAF parser code in server for window functions
#
CREATE AGGREGATE FUNCTION avgcost
diff --git a/mysql-test/main/udf.test b/mysql-test/main/udf.test
index 2e2272b2157..058f131273d 100644
--- a/mysql-test/main/udf.test
+++ b/mysql-test/main/udf.test
@@ -562,7 +562,17 @@ select * from mysql.plugin WHERE name='unexisting_udf';
--error ER_SP_DOES_NOT_EXIST
DROP FUNCTION unexisting_udf;
+--echo #
+--echo # Bug #31674599: THE UDF_INIT() FUNCTION CAUSE SERVER CRASH
+--echo #
+call mtr.add_suppression('Invalid row in mysql.func table');
+insert mysql.func () values ();
+source include/restart_mysqld.inc;
+delete from mysql.func where name = '';
+
+--echo #
--echo # End of 10.2 tests
+--echo #
--echo #
--echo # MDEV-15073: Generic UDAF parser code in server for window functions