diff options
author | unknown <pem@mysql.com> | 2005-11-25 17:09:26 +0100 |
---|---|---|
committer | unknown <pem@mysql.com> | 2005-11-25 17:09:26 +0100 |
commit | d4088df5e9a02e714d85f79bec3ea97cdd8128c6 (patch) | |
tree | 025445f5fd80e1c80878febcdebb45817594e311 /mysql-test | |
parent | df22630555ccf3b4cb6fc6254e846b87697b53c7 (diff) | |
download | mariadb-git-d4088df5e9a02e714d85f79bec3ea97cdd8128c6.tar.gz |
Fixed BUG#14233: Crash after tampering with the mysql.proc table
Post-review version. Some minor review fixes, but also changed the way
some errors are handled: Don't return specific parse errors; instead
always use the more general "table corrupt" error (amended accordingly).
mysql-test/r/sp-destruct.result:
Updated results.
mysql-test/r/sp-error.result:
Updated for fully qualified name in "no return" error message.
mysql-test/t/sp-destruct.test:
Adopted the more consistent error handling for a corrupted mysql.proc table.
(No more "parse error" et al).
sql/share/errmsg.txt:
Changed ER_SP_PROC_TABLE_CORRUPT to be more explicit.
sql/sp.cc:
Review fixes.
Changed the handling of parse errors, and added the routine name to the "table corrupt" error message.
sql/sql_base.cc:
Review changes: Change error tests and added comments.
sql/sql_parse.cc:
Mored ER_SP_NORETURN test of functions to sql_yacc.yy for more general error handling.
sql/sql_yacc.yy:
Mored ER_SP_NORETURN test of functions from sql_parse.cc for more general error handling.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/sp-destruct.result | 20 | ||||
-rw-r--r-- | mysql-test/r/sp-error.result | 2 | ||||
-rw-r--r-- | mysql-test/t/sp-destruct.test | 14 |
3 files changed, 16 insertions, 20 deletions
diff --git a/mysql-test/r/sp-destruct.result b/mysql-test/r/sp-destruct.result index 65d72d2098b..1b720be9403 100644 --- a/mysql-test/r/sp-destruct.result +++ b/mysql-test/r/sp-destruct.result @@ -11,11 +11,11 @@ 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) +ERROR HY000: Failed to load routine test.bug14233. 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) +ERROR HY000: Failed to load routine test.bug14233_f. 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) +ERROR HY000: Failed to load routine test.bug14233. 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' @@ -59,21 +59,19 @@ values 'root@localhost', NOW() , '0000-00-00 00:00:00', '', '' ); select bug14233_1(); -ERROR 0A000: Not allowed to return a result set from a function +ERROR HY000: Failed to load routine test.bug14233_1. The table mysql.proc is missing, corrupt, or contains bad data (internal code -6) create view v1 as select bug14233_1(); -ERROR 0A000: Not allowed to return a result set from a function +ERROR HY000: Failed to load routine test.bug14233_1. The table mysql.proc is missing, corrupt, or contains bad data (internal code -6) select bug14233_2(); -ERROR 2F005: FUNCTION bug14233_2 ended without RETURN +ERROR HY000: Failed to load routine test.bug14233_2. The table mysql.proc is missing, corrupt, or contains bad data (internal code -6) create view v1 as select bug14233_2(); -select * from v1; -ERROR 2F005: FUNCTION bug14233_2 ended without RETURN +ERROR HY000: Failed to load routine test.bug14233_2. The table mysql.proc is missing, corrupt, or contains bad data (internal code -6) 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 +ERROR HY000: Failed to load routine test.bug14233_3. The table mysql.proc is missing, corrupt, or contains bad data (internal code -6) 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 +ERROR HY000: Failed to load routine test.bug14233_3. The table mysql.proc is missing, corrupt, or contains bad data (internal code -6) delete from mysql.proc where name like 'bug14233%'; drop trigger t1_ai; drop table t1; -drop view v1; diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index 50ff7ea264a..cea0b66418e 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -124,7 +124,7 @@ begin declare x int; set x = val+3; end| -ERROR 42000: No RETURN found in FUNCTION f +ERROR 42000: No RETURN found in FUNCTION test.f create function f(val int) returns int begin declare x int; diff --git a/mysql-test/t/sp-destruct.test b/mysql-test/t/sp-destruct.test index 7b13d273bd1..a2a66090866 100644 --- a/mysql-test/t/sp-destruct.test +++ b/mysql-test/t/sp-destruct.test @@ -101,26 +101,24 @@ values 'root@localhost', NOW() , '0000-00-00 00:00:00', '', '' ); ---error ER_SP_NO_RETSET +--error ER_SP_PROC_TABLE_CORRUPT select bug14233_1(); ---error ER_SP_NO_RETSET +--error ER_SP_PROC_TABLE_CORRUPT create view v1 as select bug14233_1(); ---error ER_SP_NORETURNEND +--error ER_SP_PROC_TABLE_CORRUPT select bug14233_2(); +--error ER_SP_PROC_TABLE_CORRUPT create view v1 as select bug14233_2(); ---error ER_SP_NORETURNEND -select * from v1; ---error ER_PARSE_ERROR +--error ER_SP_PROC_TABLE_CORRUPT call bug14233_3(); drop trigger t1_ai; create trigger t1_ai after insert on t1 for each row call bug14233_3(); ---error ER_PARSE_ERROR +--error ER_SP_PROC_TABLE_CORRUPT insert into t1 values (0); # Clean-up delete from mysql.proc where name like 'bug14233%'; drop trigger t1_ai; drop table t1; -drop view v1; |