1--source include/have_innodb.inc
2
3--echo #
4--echo # Bug 1540338 (CREATE TABLE ... LIKE ... may create a system table with an unsupported enforced engine)
5--echo #
6
7# We cannot put --enforce-storage-engine=INNODB into an MTR option file as that
8# will break the testcase check afterwards
9--let $restart_parameters=restart:--enforce-storage-engine=INNODB
10--source include/restart_mysqld.inc
11
12SELECT ENGINE INTO @mysql_proc_engine FROM INFORMATION_SCHEMA.TABLES
13       WHERE TABLE_SCHEMA="mysql" AND TABLE_NAME="proc";
14
15--let $assert_text= Enforced SE and existing mysql.proc SE must differ
16--let $assert_cond= @@enforce_storage_engine != @mysql_proc_engine
17--source include/assert.inc
18
19RENAME TABLE mysql.proc TO proc_backup;
20
21SELECT ENGINE INTO @proc_backup_engine FROM INFORMATION_SCHEMA.TABLES
22       WHERE TABLE_SCHEMA="test" AND TABLE_NAME="proc_backup";
23
24--let $assert_text= RENAME TABLE must not change SE
25--let $assert_cond= @mysql_proc_engine = @proc_backup_engine
26--source include/assert.inc
27
28SET SESSION sql_mode='NO_AUTO_CREATE_USER';
29--error ER_UNSUPPORTED_ENGINE
30CREATE TABLE mysql.proc LIKE proc_backup;
31
32SET SESSION sql_mode='NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
33--error ER_UNKNOWN_STORAGE_ENGINE
34CREATE TABLE mysql.proc LIKE proc_backup;
35SET SESSION sql_mode=default;
36
37RENAME TABLE proc_backup TO mysql.proc;
38
39SELECT ENGINE INTO @new_mysql_proc_engine FROM INFORMATION_SCHEMA.TABLES
40       WHERE TABLE_SCHEMA="mysql" AND TABLE_NAME="proc";
41
42--let $assert_text= RENAME TABLE must not change SE
43--let $assert_cond= @mysql_proc_engine = @new_mysql_proc_engine
44--source include/assert.inc
45
46--echo # Verify that mysql.proc is working
47select routine_name,routine_schema from information_schema.routines where routine_schema like 'bug0%';
48
49--let $restart_parameters=
50--source include/restart_mysqld.inc
51