summaryrefslogtreecommitdiffstats
path: root/mysql-test/main/mysql_upgrade-28915.test
blob: 65c8bb36dce1325a25043860901751e967dbfbba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
--source include/mysql_upgrade_preparation.inc

let $MYSQLD_DATADIR= `select @@datadir`;

--echo #
--echo # Beginning of 10.6 test
--echo #
--echo # MDEV-28915: mysql_upgrade fails due to old_mode="", with "Cannot load
--echo # from mysql.proc. The table is probably corrupted"

--echo # Show that tables are created with utf8mb3 even without UTF8_IS_UTF8MB3 (see the .opt file)

SHOW CREATE TABLE mysql.proc;
SHOW CREATE TABLE mysql.event;

--exec $MYSQL_UPGRADE --force 2>&1

--remove_file $MYSQLD_DATADIR/mysql_upgrade_info

SHOW CREATE TABLE mysql.proc;
SHOW CREATE TABLE mysql.event;

--echo # Emulate that tables were created with utf8mb4 by an older version

ALTER TABLE mysql.proc MODIFY db CHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
                       MODIFY name CHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
                       MODIFY specific_name CHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
                       MODIFY definer VARCHAR(384) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
                       MODIFY comment TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
                       MODIFY character_set_client CHAR(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
                       MODIFY collation_connection CHAR(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
                       MODIFY db_collation CHAR(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL;

ALTER TABLE mysql.event MODIFY db CHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '',
                        MODIFY name CHAR(64) CHARACTER SET utf8mb4 NOT NULL DEFAULT '',
                        MODIFY definer VARCHAR(384) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '',
                        MODIFY comment CHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '',
                        MODIFY character_set_client CHAR(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
                        MODIFY collation_connection CHAR(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
                        MODIFY db_collation CHAR(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL;

CREATE TABLE t1 (id1 INT, val1 VARCHAR(5));

DELIMITER |;

CREATE PROCEDURE sp1 ()
 BEGIN
  SELECT val1 FROM t1;
 END|

DELIMITER ;|

SELECT name, body_utf8, body FROM mysql.proc WHERE name like 'sp1';
CALL sp1();
SELECT name, body_utf8, body FROM mysql.proc WHERE name like 'sp1';

SET GLOBAL event_scheduler=ON;

SELECT name, body_utf8, body FROM mysql.event;
CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (1, 'abc');
SELECT name, body_utf8, body FROM mysql.event;


--echo # mysql_upgrade changes columns from utf8mb4 to utf8mb3

--exec $MYSQL_UPGRADE --force 2>&1
--remove_file $MYSQLD_DATADIR/mysql_upgrade_info

--vertical_results

SHOW CREATE TABLE mysql.proc;
SHOW CREATE TABLE mysql.event;

SET GLOBAL event_scheduler=OFF;
DROP EVENT ev1;
DROP PROCEDURE sp1;
DROP TABLE t1;

--echo # end of 10.6 test