summaryrefslogtreecommitdiff
path: root/mysql-test/main
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/main')
-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_explain.opt1
-rw-r--r--mysql-test/main/show_explain.test9
-rw-r--r--mysql-test/main/sp.result15
-rw-r--r--mysql-test/main/sp.test19
-rw-r--r--mysql-test/main/udf.result8
-rw-r--r--mysql-test/main/udf.test10
10 files changed, 161 insertions, 1 deletions
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_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 2a87d24cf6d..542701bc42b 100644
--- a/mysql-test/main/show_explain.test
+++ b/mysql-test/main/show_explain.test
@@ -861,7 +861,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.result b/mysql-test/main/sp.result
index 5ad68afb5ad..6510eaf77f5 100644
--- a/mysql-test/main/sp.result
+++ b/mysql-test/main/sp.result
@@ -8487,6 +8487,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 ed4d8d63524..d6fba77b854 100644
--- a/mysql-test/main/sp.test
+++ b/mysql-test/main/sp.test
@@ -10026,6 +10026,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 d875d7bb52c..f426e484735 100644
--- a/mysql-test/main/udf.result
+++ b/mysql-test/main/udf.result
@@ -492,4 +492,12 @@ 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 ();
+delete from mysql.func where name = '';
+#
# End of 10.2 tests
+#
diff --git a/mysql-test/main/udf.test b/mysql-test/main/udf.test
index 9007ced0409..d0c71ffa7e6 100644
--- a/mysql-test/main/udf.test
+++ b/mysql-test/main/udf.test
@@ -562,4 +562,14 @@ 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 #