1call mtr.add_suppression("Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted"); 2call mtr.add_suppression("Stored routine .test...bug14233_[123].: invalid value in column mysql.proc"); 3use test; 4drop procedure if exists bug14233; 5drop function if exists bug14233; 6drop table if exists t1; 7drop view if exists v1; 8create procedure bug14233() 9set @x = 42; 10create function bug14233_f() returns int 11return 42; 12create table t1 (id int); 13create trigger t1_ai after insert on t1 for each row call bug14233(); 14alter table mysql.proc drop type; 15call bug14233(); 16ERROR HY000: Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted 17create view v1 as select bug14233_f(); 18ERROR HY000: Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted 19insert into t1 values (0); 20ERROR HY000: Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted 21show procedure status; 22ERROR HY000: Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted 23flush table mysql.proc; 24call bug14233(); 25ERROR HY000: Incorrect information in file: './mysql/proc.frm' 26create view v1 as select bug14233_f(); 27ERROR HY000: Incorrect information in file: './mysql/proc.frm' 28insert into t1 values (0); 29ERROR HY000: Incorrect information in file: './mysql/proc.frm' 30flush table mysql.proc; 31call bug14233(); 32ERROR 42S02: Table 'mysql.proc' doesn't exist 33create view v1 as select bug14233_f(); 34ERROR 42S02: Table 'mysql.proc' doesn't exist 35insert into t1 values (0); 36ERROR 42S02: Table 'mysql.proc' doesn't exist 37flush table mysql.proc; 38flush privileges; 39delete from mysql.proc where name like 'bug14233%'; 40insert into mysql.proc 41( 42db, name, type, specific_name, language, sql_data_access, is_deterministic, 43security_type, param_list, returns, body, definer, created, modified, 44sql_mode, comment, character_set_client, collation_connection, db_collation, 45body_utf8 46) 47values 48( 49'test', 'bug14233_1', 'FUNCTION', 'bug14233_1', 'SQL', 'READS_SQL_DATA', 'NO', 50'DEFINER', '', 'int(10)', 51'select count(*) from mysql.user', 52'root@localhost', NOW() , '0000-00-00 00:00:00', '', '', 53'', '', '', 54'select count(*) from mysql.user' 55), 56( 57'test', 'bug14233_2', 'FUNCTION', 'bug14233_2', 'SQL', 'READS_SQL_DATA', 'NO', 58'DEFINER', '', 'int(10)', 59'begin declare x int; select count(*) into x from mysql.user; end', 60'root@localhost', NOW() , '0000-00-00 00:00:00', '', '', 61'', '', '', 62'begin declare x int; select count(*) into x from mysql.user; end' 63), 64( 65'test', 'bug14233_3', 'PROCEDURE', 'bug14233_3', 'SQL', 'READS_SQL_DATA','NO', 66'DEFINER', '', '', 67'alksj wpsj sa ^#!@ ', 68'root@localhost', NOW() , '0000-00-00 00:00:00', '', '', 69'', '', '', 70'alksj wpsj sa ^#!@ ' 71); 72select bug14233_1(); 73ERROR HY000: Failed to load routine test.bug14233_1. The table mysql.proc is missing, corrupt, or contains bad data (internal code -6) 74create view v1 as select bug14233_1(); 75ERROR HY000: Failed to load routine test.bug14233_1. The table mysql.proc is missing, corrupt, or contains bad data (internal code -6) 76select bug14233_2(); 77ERROR HY000: Failed to load routine test.bug14233_2. The table mysql.proc is missing, corrupt, or contains bad data (internal code -6) 78create view v1 as select bug14233_2(); 79ERROR HY000: Failed to load routine test.bug14233_2. The table mysql.proc is missing, corrupt, or contains bad data (internal code -6) 80call bug14233_3(); 81ERROR HY000: Failed to load routine test.bug14233_3. The table mysql.proc is missing, corrupt, or contains bad data (internal code -6) 82drop trigger t1_ai; 83create trigger t1_ai after insert on t1 for each row call bug14233_3(); 84insert into t1 values (0); 85ERROR HY000: Failed to load routine test.bug14233_3. The table mysql.proc is missing, corrupt, or contains bad data (internal code -6) 86drop trigger t1_ai; 87drop table t1; 88drop function bug14233_1; 89drop function bug14233_2; 90drop procedure bug14233_3; 91show procedure status where db=DATABASE(); 92Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation 93show function status where db=DATABASE(); 94Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation 95DROP TABLE IF EXISTS proc_backup; 96DROP PROCEDURE IF EXISTS p1; 97# Backup the proc table 98RENAME TABLE mysql.proc TO proc_backup; 99CREATE TABLE mysql.proc LIKE proc_backup; 100FLUSH TABLE mysql.proc; 101# Test with a valid table. 102CREATE PROCEDURE p1() 103SET @foo = 10; 104CALL p1(); 105SHOW PROCEDURE STATUS; 106Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation 107test p1 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci 108# Modify a field of the table. 109ALTER TABLE mysql.proc MODIFY comment CHAR (32); 110CREATE PROCEDURE p2() 111SET @foo = 10; 112ERROR HY000: Cannot load from mysql.proc. The table is probably corrupted 113# Procedure loaded from the cache 114CALL p1(); 115SHOW PROCEDURE STATUS; 116ERROR HY000: Cannot load from mysql.proc. The table is probably corrupted 117DROP TABLE mysql.proc; 118RENAME TABLE proc_backup TO mysql.proc; 119FLUSH TABLE mysql.proc; 120# 121# Bug#51376 Assert `! is_set()' failed in 122# Diagnostics_area::set_ok_status on DROP FUNCTION 123# 124DROP FUNCTION IF EXISTS f1; 125CREATE FUNCTION f1() RETURNS INT RETURN 1; 126# Backup the procs_priv table 127RENAME TABLE mysql.procs_priv TO procs_priv_backup; 128FLUSH TABLE mysql.procs_priv; 129DROP FUNCTION f1; 130ERROR 42S02: Table 'mysql.procs_priv' doesn't exist 131SHOW WARNINGS; 132Level Code Message 133Error 1146 Table 'mysql.procs_priv' doesn't exist 134Warning 1405 Failed to revoke all privileges to dropped routine 135# Restore the procs_priv table 136RENAME TABLE procs_priv_backup TO mysql.procs_priv; 137FLUSH TABLE mysql.procs_priv; 138# 139# Bug #56137 "Assertion `thd->lock == 0' failed on upgrading from 140# 5.1.50 to 5.5.6". 141# 142drop database if exists mysqltest; 143# Backup mysql.proc. 144flush table mysql.proc; 145create database mysqltest; 146# Corrupt mysql.proc to make it unusable by current version of server. 147alter table mysql.proc drop column type; 148# The below statement should not cause assertion failure. 149drop database mysqltest; 150Warnings: 151Error 1805 Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted 152# Restore mysql.proc. 153drop table mysql.proc; 154# 155# Bug#58414 mysql_upgrade fails on dump upgrade between 5.1.53 -> 5.5.8 156# 157DROP TABLE IF EXISTS proc_backup; 158DROP DATABASE IF EXISTS db1; 159# Backup the proc table 160RENAME TABLE mysql.proc TO proc_backup; 161CREATE TABLE mysql.proc LIKE proc_backup; 162CREATE DATABASE db1; 163CREATE PROCEDURE db1.p1() SET @foo = 10; 164# Modify a field of the table. 165ALTER TABLE mysql.proc MODIFY comment CHAR (32); 166DROP DATABASE db1; 167Warnings: 168Error 1728 Cannot load from mysql.proc. The table is probably corrupted 169# Restore mysql.proc 170DROP TABLE mysql.proc; 171RENAME TABLE proc_backup TO mysql.proc; 172