diff options
author | unknown <pem@mysql.com> | 2005-10-26 15:34:57 +0200 |
---|---|---|
committer | unknown <pem@mysql.com> | 2005-10-26 15:34:57 +0200 |
commit | 9349f18b4491b55d8edc4a314131bd44108278ad (patch) | |
tree | 8438f02a4a9ed206e60f26923143418163c0ba22 /mysql-test/r/sp-destruct.result | |
parent | 10a889a577e1a09f29922ba20d7e8ad96449bb04 (diff) | |
download | mariadb-git-9349f18b4491b55d8edc4a314131bd44108278ad.tar.gz |
Fixed BUG#14233: Crash after tampering with the mysql.proc table
Added error checking for errors when attempting to use stored procedures
after the mysql.proc table has been dropped, corrupted, or tampered with.
Test cases were put in a separate file (sp-destruct.test).
mysql-test/t/sp.test:
Added comment.
sql/share/errmsg.txt:
New error message for corrupted mysql.proc table.
sql/sp.cc:
Check and return error code when caching stored routines.
In the case when no error message has been set, set one.
sql/sp.h:
Return error code from stored routine cache function.
sql/sql_base.cc:
Check for error from sp_cache_routines_* calls.
sql/sql_trigger.h:
Updated friend declaration for sp_cache_routines*.
mysql-test/r/sp-destruct.result:
New test file for destruction of the mysql.proc table.
mysql-test/t/sp-destruct.test:
New result file for destruction of the mysql.proc table.
Diffstat (limited to 'mysql-test/r/sp-destruct.result')
-rw-r--r-- | mysql-test/r/sp-destruct.result | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/mysql-test/r/sp-destruct.result b/mysql-test/r/sp-destruct.result new file mode 100644 index 00000000000..4f3af87c012 --- /dev/null +++ b/mysql-test/r/sp-destruct.result @@ -0,0 +1,87 @@ +use mysql; +drop table if exists proc_backup; +create table proc_backup as select * from proc; +use test; +drop procedure if exists bug14233; +drop function if exists bug14233; +drop table if exists t1; +drop view if exists v1; +create procedure bug14233() +set @x = 42; +create function bug14233_f() returns int +return 42; +create table t1 (id int); +create trigger t1_ai after insert on t1 for each row call bug14233(); +alter table mysql.proc drop type; +call bug14233(); +ERROR HY000: The table mysql.proc is missing, corrupt, or contains bad data (internal code -5) +create view v1 as select bug14233_f(); +ERROR HY000: The table mysql.proc is missing, corrupt, or contains bad data (internal code -5) +insert into t1 values (0); +ERROR HY000: The table mysql.proc is missing, corrupt, or contains bad data (internal code -5) +flush table mysql.proc; +call bug14233(); +ERROR HY000: Incorrect information in file: './mysql/proc.frm' +create view v1 as select bug14233_f(); +ERROR HY000: Incorrect information in file: './mysql/proc.frm' +insert into t1 values (0); +ERROR HY000: Incorrect information in file: './mysql/proc.frm' +flush table mysql.proc; +call bug14233(); +ERROR 42S02: Table 'mysql.proc' doesn't exist +create view v1 as select bug14233_f(); +ERROR 42S02: Table 'mysql.proc' doesn't exist +insert into t1 values (0); +ERROR 42S02: Table 'mysql.proc' doesn't exist +use mysql; +create table proc as select * from proc_backup; +alter table proc add primary key (db,name,type); +use test; +flush table mysql.proc; +flush privileges; +delete from mysql.proc where name like 'bug14233%'; +insert into mysql.proc +( +db, name, type, specific_name, language, sql_data_access, is_deterministic, +security_type, param_list, returns, body, definer, created, modified, +sql_mode, comment +) +values +( +'test', 'bug14233_1', 'FUNCTION', 'bug14233_1', 'SQL', 'READS_SQL_DATA', 'NO', +'DEFINER', '', 'int(10)', +'select count(*) from mysql.user', +'root@localhost', NOW() , '0000-00-00 00:00:00', '', '' +), +( +'test', 'bug14233_2', 'FUNCTION', 'bug14233_2', 'SQL', 'READS_SQL_DATA', 'NO', +'DEFINER', '', 'int(10)', +'begin declare x int; select count(*) into x from mysql.user; end', +'root@localhost', NOW() , '0000-00-00 00:00:00', '', '' +), +( +'test', 'bug14233_3', 'PROCEDURE', 'bug14233_3', 'SQL', 'READS_SQL_DATA','NO', +'DEFINER', '', '', +'alksj wpsj sa ^#!@ ', +'root@localhost', NOW() , '0000-00-00 00:00:00', '', '' +); +select bug14233_1(); +ERROR 0A000: Not allowed to return a result set from a function +create view v1 as select bug14233_1(); +ERROR 0A000: Not allowed to return a result set from a function +select bug14233_2(); +ERROR 2F005: FUNCTION bug14233_2 ended without RETURN +create view v1 as select bug14233_2(); +select * from v1; +ERROR 2F005: FUNCTION bug14233_2 ended without RETURN +call bug14233_3(); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'wpsj sa ^#!@ ' at line 3 +drop trigger t1_ai; +create trigger t1_ai after insert on t1 for each row call bug14233_3(); +insert into t1 values (0); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'wpsj sa ^#!@ ' at line 3 +delete from mysql.proc where name like 'bug14233%'; +drop table mysql.proc_backup; +drop trigger t1_ai; +drop table t1; +drop view v1; |