mariadb/mysql-test/main/mysql_upgrade-28915.test
2023-06-28 09:19:19 +03:00

79 lines
3.1 KiB
Text

--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/mariadb_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/mariadb_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