summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2015-04-28 21:11:49 +0200
committerSergei Golubchik <serg@mariadb.org>2015-04-28 21:11:49 +0200
commitf9c02d7c29e7ddc9fa274e7fe23e5800653660f4 (patch)
tree817db8c66d7feb63147fe24f8d7474a64660451a /mysql-test
parentfbab0685a7b7f39db0217823ad90dd47034eae29 (diff)
parent83ce3529b8b2ba5b8070d12aaecbb6c3e3fcaeca (diff)
downloadmariadb-git-f9c02d7c29e7ddc9fa274e7fe23e5800653660f4.tar.gz
Merge branch 'openquery/MDEV-6916-maria-5.5-check_view-r4408' into 5.5
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/mysql_upgrade.result58
-rw-r--r--mysql-test/r/mysql_upgrade_view.result205
-rw-r--r--mysql-test/std_data/mysql_upgrade/event.MYD0
-rw-r--r--mysql-test/std_data/mysql_upgrade/event.MYIbin0 -> 2048 bytes
-rw-r--r--mysql-test/std_data/mysql_upgrade/event.frmbin0 -> 10223 bytes
-rw-r--r--mysql-test/std_data/mysql_upgrade/v1.frm15
-rw-r--r--mysql-test/std_data/mysql_upgrade/v1badcheck.frm15
-rw-r--r--mysql-test/std_data/mysql_upgrade/v2.frm15
-rw-r--r--mysql-test/std_data/mysql_upgrade/v3.frm15
-rw-r--r--mysql-test/std_data/mysql_upgrade/v4.frm16
-rw-r--r--mysql-test/t/mysql_upgrade_view.test146
11 files changed, 460 insertions, 25 deletions
diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result
index fb831082dfe..502242a9845 100644
--- a/mysql-test/r/mysql_upgrade.result
+++ b/mysql-test/r/mysql_upgrade.result
@@ -1,6 +1,7 @@
Run mysql_upgrade once
-Phase 1/3: Fixing table and database names
-Phase 2/3: Checking and upgrading tables
+Phase 1/4: Fixing views
+Phase 2/4: Fixing table and database names
+Phase 3/4: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -31,13 +32,14 @@ mysql.time_zone_transition_type OK
mysql.user OK
performance_schema
test
-Phase 3/3: Running 'mysql_fix_privilege_tables'...
+Phase 4/4: Running 'mysql_fix_privilege_tables'...
OK
Run it again - should say already completed
This installation of MySQL is already upgraded to VERSION, use --force if you still need to run mysql_upgrade
Force should run it regardless of wether it's been run before
-Phase 1/3: Fixing table and database names
-Phase 2/3: Checking and upgrading tables
+Phase 1/4: Fixing views
+Phase 2/4: Fixing table and database names
+Phase 3/4: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -68,13 +70,14 @@ mysql.time_zone_transition_type OK
mysql.user OK
performance_schema
test
-Phase 3/3: Running 'mysql_fix_privilege_tables'...
+Phase 4/4: Running 'mysql_fix_privilege_tables'...
OK
CREATE USER mysqltest1@'%' IDENTIFIED by 'sakila';
GRANT ALL ON *.* TO mysqltest1@'%';
Run mysql_upgrade with password protected account
-Phase 1/3: Fixing table and database names
-Phase 2/3: Checking and upgrading tables
+Phase 1/4: Fixing views
+Phase 2/4: Fixing table and database names
+Phase 3/4: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -105,7 +108,7 @@ mysql.time_zone_transition_type OK
mysql.user OK
performance_schema
test
-Phase 3/3: Running 'mysql_fix_privilege_tables'...
+Phase 4/4: Running 'mysql_fix_privilege_tables'...
OK
DROP USER mysqltest1@'%';
Version check failed. Got the following error when calling the 'mysql' command line client
@@ -115,8 +118,9 @@ Run mysql_upgrade with a non existing server socket
mysqlcheck: Got error: 2005: Unknown MySQL server host 'not_existing_host' (errno) when trying to connect
FATAL ERROR: Upgrade failed
set GLOBAL sql_mode='STRICT_ALL_TABLES,ANSI_QUOTES,NO_ZERO_DATE';
-Phase 1/3: Fixing table and database names
-Phase 2/3: Checking and upgrading tables
+Phase 1/4: Fixing views
+Phase 2/4: Fixing table and database names
+Phase 3/4: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -147,7 +151,7 @@ mysql.time_zone_transition_type OK
mysql.user OK
performance_schema
test
-Phase 3/3: Running 'mysql_fix_privilege_tables'...
+Phase 4/4: Running 'mysql_fix_privilege_tables'...
OK
set GLOBAL sql_mode=default;
#
@@ -158,8 +162,9 @@ CREATE PROCEDURE testproc() BEGIN END;
UPDATE mysql.proc SET character_set_client = NULL WHERE name LIKE 'testproc';
UPDATE mysql.proc SET collation_connection = NULL WHERE name LIKE 'testproc';
UPDATE mysql.proc SET db_collation = NULL WHERE name LIKE 'testproc';
-Phase 1/3: Fixing table and database names
-Phase 2/3: Checking and upgrading tables
+Phase 1/4: Fixing views
+Phase 2/4: Fixing table and database names
+Phase 3/4: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -190,7 +195,7 @@ mysql.time_zone_transition_type OK
mysql.user OK
performance_schema
test
-Phase 3/3: Running 'mysql_fix_privilege_tables'...
+Phase 4/4: Running 'mysql_fix_privilege_tables'...
OK
CALL testproc();
DROP PROCEDURE testproc;
@@ -204,8 +209,9 @@ WARNING: NULL values of the 'db_collation' column ('mysql.proc' table) have been
GRANT USAGE ON *.* TO 'user3'@'%';
GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%';
Run mysql_upgrade with all privileges on a user
-Phase 1/3: Fixing table and database names
-Phase 2/3: Checking and upgrading tables
+Phase 1/4: Fixing views
+Phase 2/4: Fixing table and database names
+Phase 3/4: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -236,7 +242,7 @@ mysql.time_zone_transition_type OK
mysql.user OK
performance_schema
test
-Phase 3/3: Running 'mysql_fix_privilege_tables'...
+Phase 4/4: Running 'mysql_fix_privilege_tables'...
OK
SHOW GRANTS FOR 'user3'@'%';
Grants for user3@%
@@ -245,7 +251,7 @@ GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%'
DROP USER 'user3'@'%';
End of 5.1 tests
The --upgrade-system-tables option was used, databases won't be touched.
-Phase 3/3: Running 'mysql_fix_privilege_tables'...
+Phase 1/4: Running 'mysql_fix_privilege_tables'...
OK
#
# Bug#11827359 60223: MYSQL_UPGRADE PROBLEM WITH OPTION
@@ -253,8 +259,9 @@ OK
#
# Droping the previously created mysql_upgrade_info file..
# Running mysql_upgrade with --skip-write-binlog..
-Phase 1/3: Fixing table and database names
-Phase 2/3: Checking and upgrading tables
+Phase 1/4: Fixing views
+Phase 2/4: Fixing table and database names
+Phase 3/4: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -285,7 +292,7 @@ mysql.time_zone_transition_type OK
mysql.user OK
performance_schema
test
-Phase 3/3: Running 'mysql_fix_privilege_tables'...
+Phase 4/4: Running 'mysql_fix_privilege_tables'...
OK
#
# MDEV-4332 Increase username length from 16 characters
@@ -313,8 +320,9 @@ GRANT INSERT ON mysql.user TO very_long_user_name_number_2;
GRANT UPDATE (User) ON mysql.db TO very_long_user_name_number_1;
GRANT UPDATE (User) ON mysql.db TO very_long_user_name_number_2;
CREATE PROCEDURE test.pr() BEGIN END;
-Phase 1/3: Fixing table and database names
-Phase 2/3: Checking and upgrading tables
+Phase 1/4: Fixing views
+Phase 2/4: Fixing table and database names
+Phase 3/4: Checking and upgrading tables
Processing databases
information_schema
mtr
@@ -345,7 +353,7 @@ mysql.time_zone_transition_type OK
mysql.user OK
performance_schema
test
-Phase 3/3: Running 'mysql_fix_privilege_tables'...
+Phase 4/4: Running 'mysql_fix_privilege_tables'...
OK
SELECT definer FROM mysql.proc WHERE db = 'test' AND name = 'pr';
definer
diff --git a/mysql-test/r/mysql_upgrade_view.result b/mysql-test/r/mysql_upgrade_view.result
new file mode 100644
index 00000000000..aa393190e82
--- /dev/null
+++ b/mysql-test/r/mysql_upgrade_view.result
@@ -0,0 +1,205 @@
+set sql_log_bin=0;
+drop table if exists t1,v1,v2,v3,v4,v1badcheck;
+drop view if exists t1,v1,v2,v3,v4,v1badcheck;
+create table t1(a int);
+create table kv(k varchar(30) NOT NULL PRIMARY KEY,v varchar(50));
+flush tables;
+Phase 1/4: Fixing views
+test.v1 OK
+test.v1badcheck OK
+test.v2 OK
+test.v3 OK
+Phase 2/4: Fixing table and database names
+Phase 3/4: Checking and upgrading tables
+Processing databases
+information_schema
+mtr
+mtr.global_suppressions OK
+mtr.test_suppressions OK
+mysql
+mysql.columns_priv OK
+mysql.db OK
+mysql.event OK
+mysql.func OK
+mysql.help_category OK
+mysql.help_keyword OK
+mysql.help_relation OK
+mysql.help_topic OK
+mysql.host OK
+mysql.ndb_binlog_index OK
+mysql.plugin OK
+mysql.proc OK
+mysql.procs_priv OK
+mysql.proxies_priv OK
+mysql.servers OK
+mysql.tables_priv OK
+mysql.time_zone OK
+mysql.time_zone_leap_second OK
+mysql.time_zone_name OK
+mysql.time_zone_transition OK
+mysql.time_zone_transition_type OK
+mysql.user OK
+performance_schema
+test
+test.kv OK
+test.t1 OK
+Phase 4/4: Running 'mysql_fix_privilege_tables'...
+OK
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` utf8 utf8_general_ci
+show create view v2;
+View Create View character_set_client collation_connection
+v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`a` AS `a` from `t1` utf8 utf8_general_ci
+show create view v3;
+View Create View character_set_client collation_connection
+v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`a` AS `a` from `t1` utf8 utf8_general_ci
+set sql_log_bin=1;
+REPAIR VIEW v1,v2;
+Table Op Msg_type Msg_text
+test.v1 repair status OK
+test.v2 repair status OK
+REPAIR VIEW v1badcheck;
+Table Op Msg_type Msg_text
+test.v1badcheck repair status OK
+REPAIR NO_WRITE_TO_BINLOG VIEW v3;
+Table Op Msg_type Msg_text
+test.v3 repair status OK
+set sql_log_bin=0;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; REPAIR VIEW v1,v2
+master-bin.000001 # Query # # use `test`; REPAIR VIEW v1badcheck
+LOAD DATA INFILE 'MYSQLD_DATADIR/test/v1.frm' REPLACE INTO TABLE kv FIELDS TERMINATED BY '=';
+SELECT k,v from kv where k in ('md5','algorithm');
+k v
+algorithm 1
+md5 5e6eaf216e7b016fcedfd4e1113517af
+SELECT k from kv where k ='mariadb-version';
+k
+mariadb-version
+truncate table kv;
+LOAD DATA INFILE 'MYSQLD_DATADIR/test/v2.frm' REPLACE INTO TABLE kv FIELDS TERMINATED BY '=';
+SELECT k,v from kv where k in ('md5','algorithm');
+k v
+algorithm 2
+md5 5e6eaf216e7b016fcedfd4e1113517af
+SELECT k from kv where k ='mariadb-version';
+k
+mariadb-version
+truncate table kv;
+LOAD DATA INFILE 'MYSQLD_DATADIR/test/v3.frm' REPLACE INTO TABLE kv FIELDS TERMINATED BY '=';
+SELECT k,v from kv where k in ('md5','algorithm');
+k v
+algorithm 0
+md5 5e6eaf216e7b016fcedfd4e1113517af
+SELECT k from kv where k ='mariadb-version';
+k
+mariadb-version
+truncate table kv;
+LOAD DATA INFILE 'MYSQLD_DATADIR/test/v1badcheck.frm' REPLACE INTO TABLE kv FIELDS TERMINATED BY '=';
+SELECT k,v from kv where k in ('md5','algorithm');
+k v
+algorithm 1
+md5 5e6eaf216e7b016fcedfd4e1113517af
+SELECT k from kv where k ='mariadb-version';
+k
+mariadb-version
+truncate table kv;
+drop view if exists v1,v2,v3,v1badcheck;
+flush tables;
+create algorithm=temptable view v4 as select a from t1;
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` utf8 utf8_general_ci
+show create view v2;
+View Create View character_set_client collation_connection
+v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`a` AS `a` from `t1` utf8 utf8_general_ci
+show create view v3;
+View Create View character_set_client collation_connection
+v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`a` AS `a` from `t1` utf8 utf8_general_ci
+show create view v4;
+View Create View character_set_client collation_connection
+v4 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci
+MySQL upgrade detected
+Phase 1/4: Fixing views from mysql
+test.v1 OK
+test.v2 OK
+test.v3 OK
+test.v4 OK
+Phase 2/4: Fixing table and database names
+Phase 3/4: Checking and upgrading tables
+Processing databases
+information_schema
+mtr
+mtr.global_suppressions OK
+mtr.test_suppressions OK
+mysql
+mysql.columns_priv OK
+mysql.db OK
+mysql.ev_bk OK
+mysql.event OK
+mysql.func OK
+mysql.help_category OK
+mysql.help_keyword OK
+mysql.help_relation OK
+mysql.help_topic OK
+mysql.host OK
+mysql.ndb_binlog_index OK
+mysql.plugin OK
+mysql.proc OK
+mysql.procs_priv OK
+mysql.proxies_priv OK
+mysql.servers OK
+mysql.tables_priv OK
+mysql.time_zone OK
+mysql.time_zone_leap_second OK
+mysql.time_zone_name OK
+mysql.time_zone_transition OK
+mysql.time_zone_transition_type OK
+mysql.user OK
+performance_schema
+test
+test.kv OK
+test.t1 OK
+Phase 4/4: Running 'mysql_fix_privilege_tables'...
+OK
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` utf8 utf8_general_ci
+show create view v2;
+View Create View character_set_client collation_connection
+v2 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`a` AS `a` from `t1` utf8 utf8_general_ci
+show create view v3;
+View Create View character_set_client collation_connection
+v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`a` AS `a` from `t1` utf8 utf8_general_ci
+show create view v4;
+View Create View character_set_client collation_connection
+v4 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci
+LOAD DATA INFILE 'MYSQLD_DATADIR/test/v1.frm' REPLACE INTO TABLE kv FIELDS TERMINATED BY '=';
+SELECT k,v from kv where k in ('md5','algorithm');
+k v
+algorithm 2
+md5 5e6eaf216e7b016fcedfd4e1113517af
+SELECT k from kv where k ='mariadb-version';
+k
+mariadb-version
+truncate table kv;
+drop view if exists v1,v2,v3;
+flush tables;
+test.v1 OK
+test.v2 OK
+test.v3 OK
+test.v4 OK
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; REPAIR VIEW v1,v2
+master-bin.000001 # Query # # use `test`; REPAIR VIEW v1badcheck
+master-bin.000001 # Query # # use `test`; REPAIR VIEW `v1` FROM MYSQL
+master-bin.000001 # Query # # use `test`; REPAIR VIEW `v2` FROM MYSQL
+master-bin.000001 # Query # # use `test`; REPAIR VIEW `v3` FROM MYSQL
+master-bin.000001 # Query # # use `test`; REPAIR VIEW `v4` FROM MYSQL
+flush tables;
+drop table if exists kv;
+drop view v1,v2,v3,v4;
+drop table t1;
diff --git a/mysql-test/std_data/mysql_upgrade/event.MYD b/mysql-test/std_data/mysql_upgrade/event.MYD
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/mysql-test/std_data/mysql_upgrade/event.MYD
diff --git a/mysql-test/std_data/mysql_upgrade/event.MYI b/mysql-test/std_data/mysql_upgrade/event.MYI
new file mode 100644
index 00000000000..d5c16c3892f
--- /dev/null
+++ b/mysql-test/std_data/mysql_upgrade/event.MYI
Binary files differ
diff --git a/mysql-test/std_data/mysql_upgrade/event.frm b/mysql-test/std_data/mysql_upgrade/event.frm
new file mode 100644
index 00000000000..fd4ff199b56
--- /dev/null
+++ b/mysql-test/std_data/mysql_upgrade/event.frm
Binary files differ
diff --git a/mysql-test/std_data/mysql_upgrade/v1.frm b/mysql-test/std_data/mysql_upgrade/v1.frm
new file mode 100644
index 00000000000..be197fd76a8
--- /dev/null
+++ b/mysql-test/std_data/mysql_upgrade/v1.frm
@@ -0,0 +1,15 @@
+TYPE=VIEW
+query=select `test`.`t1`.`a` AS `a` from `test`.`t1`
+md5=5e6eaf216e7b016fcedfd4e1113517af
+updatable=0
+algorithm=1
+definer_user=root
+definer_host=localhost
+suid=2
+with_check_option=0
+timestamp=2014-12-11 15:26:20
+create-version=1
+source=select a from t1
+client_cs_name=utf8
+connection_cl_name=utf8_general_ci
+view_body_utf8=select `test`.`t1`.`a` AS `a` from `test`.`t1`
diff --git a/mysql-test/std_data/mysql_upgrade/v1badcheck.frm b/mysql-test/std_data/mysql_upgrade/v1badcheck.frm
new file mode 100644
index 00000000000..a1e3bfe5cbc
--- /dev/null
+++ b/mysql-test/std_data/mysql_upgrade/v1badcheck.frm
@@ -0,0 +1,15 @@
+TYPE=VIEW
+query=select `test`.`t1`.`a` AS `a` from `test`.`t1`
+md5=00000000000000000000000000000000
+updatable=0
+algorithm=1
+definer_user=root
+definer_host=localhost
+suid=2
+with_check_option=0
+timestamp=2014-12-11 15:26:20
+create-version=1
+source=select a from t1
+client_cs_name=utf8
+connection_cl_name=utf8_general_ci
+view_body_utf8=select `test`.`t1`.`a` AS `a` from `test`.`t1`
diff --git a/mysql-test/std_data/mysql_upgrade/v2.frm b/mysql-test/std_data/mysql_upgrade/v2.frm
new file mode 100644
index 00000000000..42cc06d9fba
--- /dev/null
+++ b/mysql-test/std_data/mysql_upgrade/v2.frm
@@ -0,0 +1,15 @@
+TYPE=VIEW
+query=select `test`.`t1`.`a` AS `a` from `test`.`t1`
+md5=5e6eaf216e7b016fcedfd4e1113517af
+updatable=1
+algorithm=2
+definer_user=root
+definer_host=localhost
+suid=2
+with_check_option=0
+timestamp=2014-12-11 15:26:29
+create-version=1
+source=select a from t1
+client_cs_name=utf8
+connection_cl_name=utf8_general_ci
+view_body_utf8=select `test`.`t1`.`a` AS `a` from `test`.`t1`
diff --git a/mysql-test/std_data/mysql_upgrade/v3.frm b/mysql-test/std_data/mysql_upgrade/v3.frm
new file mode 100644
index 00000000000..cca46ae9170
--- /dev/null
+++ b/mysql-test/std_data/mysql_upgrade/v3.frm
@@ -0,0 +1,15 @@
+TYPE=VIEW
+query=select `test`.`t1`.`a` AS `a` from `test`.`t1`
+md5=5e6eaf216e7b016fcedfd4e1113517af
+updatable=0
+algorithm=0
+definer_user=root
+definer_host=localhost
+suid=2
+with_check_option=0
+timestamp=2014-12-11 15:26:20
+create-version=1
+source=select a from t1
+client_cs_name=utf8
+connection_cl_name=utf8_general_ci
+view_body_utf8=select `test`.`t1`.`a` AS `a` from `test`.`t1`
diff --git a/mysql-test/std_data/mysql_upgrade/v4.frm b/mysql-test/std_data/mysql_upgrade/v4.frm
new file mode 100644
index 00000000000..9d0cc48447d
--- /dev/null
+++ b/mysql-test/std_data/mysql_upgrade/v4.frm
@@ -0,0 +1,16 @@
+TYPE=VIEW
+query=select `test`.`t1`.`a` AS `a` from `test`.`t1`
+md5=5e6eaf216e7b016fcedfd4e1113517a0
+updatable=1
+algorithm=0
+definer_user=root
+definer_host=localhost
+suid=2
+with_check_option=0
+timestamp=2015-02-08 19:21:14
+create-version=1
+source=select a from t1
+client_cs_name=latin1
+connection_cl_name=latin1_swedish_ci
+view_body_utf8=select `test`.`t1`.`a` AS `a` from `test`.`t1`
+mariadb-version=50542
diff --git a/mysql-test/t/mysql_upgrade_view.test b/mysql-test/t/mysql_upgrade_view.test
new file mode 100644
index 00000000000..1b491a71227
--- /dev/null
+++ b/mysql-test/t/mysql_upgrade_view.test
@@ -0,0 +1,146 @@
+-- source include/have_log_bin.inc
+
+set sql_log_bin=0;
+--disable_warnings
+drop table if exists t1,v1,v2,v3,v4,v1badcheck;
+drop view if exists t1,v1,v2,v3,v4,v1badcheck;
+--enable_warnings
+
+create table t1(a int);
+create table kv(k varchar(30) NOT NULL PRIMARY KEY,v varchar(50));
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v1.frm $MYSQLD_DATADIR/test/v1.frm
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v1badcheck.frm $MYSQLD_DATADIR/test/v1badcheck.frm
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v2.frm $MYSQLD_DATADIR/test/v2.frm
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v3.frm $MYSQLD_DATADIR/test/v3.frm
+
+flush tables;
+
+--replace_result $MYSQLTEST_VARDIR var
+--exec $MYSQL_UPGRADE --force 2>&1
+
+# "Phase 1/4: Fixing views" expected (without from_mysql)
+
+show create view v1;
+show create view v2;
+show create view v3;
+
+# Now force a mariadb version to be added
+
+set sql_log_bin=1;
+REPAIR VIEW v1,v2;
+REPAIR VIEW v1badcheck;
+REPAIR NO_WRITE_TO_BINLOG VIEW v3;
+set sql_log_bin=0;
+
+--source include/show_binlog_events.inc
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval LOAD DATA INFILE '$MYSQLD_DATADIR/test/v1.frm' REPLACE INTO TABLE kv FIELDS TERMINATED BY '=';
+SELECT k,v from kv where k in ('md5','algorithm');
+SELECT k from kv where k ='mariadb-version';
+truncate table kv;
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval LOAD DATA INFILE '$MYSQLD_DATADIR/test/v2.frm' REPLACE INTO TABLE kv FIELDS TERMINATED BY '=';
+SELECT k,v from kv where k in ('md5','algorithm');
+SELECT k from kv where k ='mariadb-version';
+truncate table kv;
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval LOAD DATA INFILE '$MYSQLD_DATADIR/test/v3.frm' REPLACE INTO TABLE kv FIELDS TERMINATED BY '=';
+SELECT k,v from kv where k in ('md5','algorithm');
+SELECT k from kv where k ='mariadb-version';
+truncate table kv;
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval LOAD DATA INFILE '$MYSQLD_DATADIR/test/v1badcheck.frm' REPLACE INTO TABLE kv FIELDS TERMINATED BY '=';
+SELECT k,v from kv where k in ('md5','algorithm');
+SELECT k from kv where k ='mariadb-version';
+truncate table kv;
+
+--disable_warnings
+drop view if exists v1,v2,v3,v1badcheck;
+--enable_warnings
+
+# Make it look like a MySQL directory now
+
+--copy_file $MYSQLD_DATADIR/mysql/event.MYI $MYSQLD_DATADIR/mysql/ev_bk.MYI
+--copy_file $MYSQLD_DATADIR/mysql/event.MYD $MYSQLD_DATADIR/mysql/ev_bk.MYD
+--copy_file $MYSQLD_DATADIR/mysql/event.frm $MYSQLD_DATADIR/mysql/ev_bk.frm
+--remove_file $MYSQLD_DATADIR/mysql/event.MYI
+--remove_file $MYSQLD_DATADIR/mysql/event.MYD
+--remove_file $MYSQLD_DATADIR/mysql/event.frm
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/event.MYI $MYSQLD_DATADIR/mysql/event.MYI
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/event.MYD $MYSQLD_DATADIR/mysql/event.MYD
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/event.frm $MYSQLD_DATADIR/mysql/event.frm
+
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v1.frm $MYSQLD_DATADIR/test/v1.frm
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v2.frm $MYSQLD_DATADIR/test/v2.frm
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v3.frm $MYSQLD_DATADIR/test/v3.frm
+
+flush tables;
+
+create algorithm=temptable view v4 as select a from t1;
+show create view v1;
+show create view v2;
+show create view v3;
+show create view v4;
+
+# here we test the fixing views from mysql to occur
+--replace_result $MYSQLTEST_VARDIR var
+--exec $MYSQL_UPGRADE --force 2>&1
+
+show create view v1;
+show create view v2;
+show create view v3;
+show create view v4;
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval LOAD DATA INFILE '$MYSQLD_DATADIR/test/v1.frm' REPLACE INTO TABLE kv FIELDS TERMINATED BY '=';
+SELECT k,v from kv where k in ('md5','algorithm');
+SELECT k from kv where k ='mariadb-version';
+truncate table kv;
+
+--disable_warnings
+drop view if exists v1,v2,v3;
+--enable_warnings
+
+
+--remove_file $MYSQLD_DATADIR/mysql/event.MYI
+--remove_file $MYSQLD_DATADIR/mysql/event.MYD
+--remove_file $MYSQLD_DATADIR/mysql/event.frm
+
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/event.MYI $MYSQLD_DATADIR/mysql/event.MYI
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/event.MYD $MYSQLD_DATADIR/mysql/event.MYD
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/event.frm $MYSQLD_DATADIR/mysql/event.frm
+
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v1.frm $MYSQLD_DATADIR/test/v1.frm
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v2.frm $MYSQLD_DATADIR/test/v2.frm
+--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v3.frm $MYSQLD_DATADIR/test/v3.frm
+flush tables;
+
+# check of binlog
+--exec $MYSQL_CHECK --write-binlog --upgrade-views=FROM_MYSQL --skip-fix-tables --all-databases 2>&1
+
+--source include/show_binlog_events.inc
+
+# back to mariadb default
+
+--remove_file $MYSQLD_DATADIR/mysql/event.MYI
+--remove_file $MYSQLD_DATADIR/mysql/event.MYD
+--remove_file $MYSQLD_DATADIR/mysql/event.frm
+--copy_file $MYSQLD_DATADIR/mysql/ev_bk.MYI $MYSQLD_DATADIR/mysql/event.MYI
+--copy_file $MYSQLD_DATADIR/mysql/ev_bk.MYD $MYSQLD_DATADIR/mysql/event.MYD
+--copy_file $MYSQLD_DATADIR/mysql/ev_bk.frm $MYSQLD_DATADIR/mysql/event.frm
+--remove_file $MYSQLD_DATADIR/mysql/ev_bk.MYI
+--remove_file $MYSQLD_DATADIR/mysql/ev_bk.MYD
+--remove_file $MYSQLD_DATADIR/mysql/ev_bk.frm
+flush tables;
+
+drop table if exists kv;
+drop view v1,v2,v3,v4;
+drop table t1;
+