summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2019-03-29 10:58:20 +0100
committerSergei Golubchik <serg@mariadb.org>2019-03-29 10:58:20 +0100
commitf2a0c758da3d9f0fa42c96114b453cf4835bcbab (patch)
treed51cdc29774cfc04f522e2253542d73c94a9728b /mysql-test
parentfc168c3a5e58d8b364a2e87e0d876a261ec7fced (diff)
parentd0116e10a5da52503a89a413e481996ce3f65e63 (diff)
downloadmariadb-git-f2a0c758da3d9f0fa42c96114b453cf4835bcbab.tar.gz
Merge branch '10.1' into 10.2
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/type_blob.result9
-rw-r--r--mysql-test/suite/binlog/r/binlog_innodb_stm.result17
-rw-r--r--mysql-test/suite/binlog/t/binlog_innodb_stm.test26
-rw-r--r--mysql-test/suite/rpl/r/rpl_slave_invalid_external_user.result15
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_invalid_external_user.test42
-rw-r--r--mysql-test/t/type_blob.test5
6 files changed, 114 insertions, 0 deletions
diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result
index 3c99366168c..38021807b55 100644
--- a/mysql-test/r/type_blob.result
+++ b/mysql-test/r/type_blob.result
@@ -1076,6 +1076,15 @@ t1 CREATE TABLE `t1` (
`a` longtext CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
+create table t1 (a int);
+alter table t1 add column b blob, alter column b set default "foo";
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` blob DEFAULT 'foo'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
#
# End of 10.2 test
#
diff --git a/mysql-test/suite/binlog/r/binlog_innodb_stm.result b/mysql-test/suite/binlog/r/binlog_innodb_stm.result
new file mode 100644
index 00000000000..829ed7d3c61
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_innodb_stm.result
@@ -0,0 +1,17 @@
+create table categories(
+cat_id int not null primary key,
+cat_name varchar(255) not null,
+cat_description text
+) engine=innodb;
+create table products(
+prd_id int not null auto_increment primary key,
+prd_name varchar(355) not null,
+prd_price decimal,
+cat_id int not null,
+foreign key fk_cat(cat_id)
+references categories(cat_id)
+on update cascade
+) engine=innodb;
+insert into categories values (1, 'drinks', 'drinks');
+update categories set cat_description=2 where cat_id=1;
+drop table products, categories;
diff --git a/mysql-test/suite/binlog/t/binlog_innodb_stm.test b/mysql-test/suite/binlog/t/binlog_innodb_stm.test
new file mode 100644
index 00000000000..4dfa7a76584
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_innodb_stm.test
@@ -0,0 +1,26 @@
+source include/have_innodb.inc;
+source include/have_binlog_format_statement.inc;
+
+#
+# MDEV-18466 Unsafe to log updates on tables referenced by foreign keys with triggers in statement format
+#
+
+create table categories(
+ cat_id int not null primary key,
+ cat_name varchar(255) not null,
+ cat_description text
+) engine=innodb;
+
+create table products(
+ prd_id int not null auto_increment primary key,
+ prd_name varchar(355) not null,
+ prd_price decimal,
+ cat_id int not null,
+ foreign key fk_cat(cat_id)
+ references categories(cat_id)
+ on update cascade
+) engine=innodb;
+
+insert into categories values (1, 'drinks', 'drinks');
+update categories set cat_description=2 where cat_id=1;
+drop table products, categories;
diff --git a/mysql-test/suite/rpl/r/rpl_slave_invalid_external_user.result b/mysql-test/suite/rpl/r/rpl_slave_invalid_external_user.result
new file mode 100644
index 00000000000..29b815420ba
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_slave_invalid_external_user.result
@@ -0,0 +1,15 @@
+include/master-slave.inc
+[connection master]
+CREATE USER test_user@localhost;
+SET PASSWORD FOR test_user@localhost = password('PWD');
+GRANT ALL ON *.* TO test_user@localhost WITH GRANT OPTION;
+connect conn_test,localhost,test_user,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection conn_test;
+CREATE TABLE t1 (f1 INT);
+CREATE TABLE t2 (f2 VARCHAR(64));
+CREATE TRIGGER tr_before BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 SELECT variable_name FROM INFORMATION_SCHEMA.SESSION_VARIABLES;
+CREATE DEFINER='root'@'localhost' TRIGGER tr_after AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 SELECT variable_name FROM INFORMATION_SCHEMA.SESSION_VARIABLES;
+INSERT INTO t1 VALUES (1);
+DROP USER 'test_user'@'localhost';
+DROP TABLE t1, t2;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_slave_invalid_external_user.test b/mysql-test/suite/rpl/t/rpl_slave_invalid_external_user.test
new file mode 100644
index 00000000000..5099d7ee49e
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_slave_invalid_external_user.test
@@ -0,0 +1,42 @@
+# ==== Purpose ====
+#
+# Test verifies that when applier thread tries to access 'variable_name' of
+# INFORMATION_SCHEMA.SESSION_VARIABLES table through triggers it successfully
+# retrieves all the session variables.
+#
+# ==== Implementation ====
+#
+# Steps:
+# 0 - Create two tables t1 and t2.
+# 1 - Create a trigger such that it reads the names of all session variables
+# from INFORMATION_SCHEMA.SESSION_VARIABLES table and populates one of the
+# tables.
+# 2 - Do a DML on master and wait for it to be replicated and ensure that
+# slave is in sync with master and it is up and running.
+#
+# ==== References ====
+#
+# MDEV-14784: Slave crashes in show_status_array upon running a trigger with
+# select from I_S
+
+--source include/master-slave.inc
+--source include/have_binlog_format_mixed.inc
+--enable_connect_log
+CREATE USER test_user@localhost;
+SET PASSWORD FOR test_user@localhost = password('PWD');
+GRANT ALL ON *.* TO test_user@localhost WITH GRANT OPTION;
+connect(conn_test,localhost,test_user,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK);
+
+--connection conn_test
+CREATE TABLE t1 (f1 INT);
+CREATE TABLE t2 (f2 VARCHAR(64));
+CREATE TRIGGER tr_before BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 SELECT variable_name FROM INFORMATION_SCHEMA.SESSION_VARIABLES;
+CREATE DEFINER='root'@'localhost' TRIGGER tr_after AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 SELECT variable_name FROM INFORMATION_SCHEMA.SESSION_VARIABLES;
+
+INSERT INTO t1 VALUES (1);
+--disable_connect_log
+# Cleanup
+--connection master
+DROP USER 'test_user'@'localhost';
+DROP TABLE t1, t2;
+--source include/rpl_end.inc
diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test
index 2c74d4ea241..f97ddc755ce 100644
--- a/mysql-test/t/type_blob.test
+++ b/mysql-test/t/type_blob.test
@@ -694,6 +694,11 @@ CREATE TABLE t1 (a TEXT(1431655798) CHARACTER SET utf8);
SHOW CREATE TABLE t1;
DROP TABLE t1;
+# ALTER SET DEFAULT
+create table t1 (a int);
+alter table t1 add column b blob, alter column b set default "foo";
+show create table t1;
+drop table t1;
--echo #
--echo # End of 10.2 test