diff options
Diffstat (limited to 'mysql-test/r/sp-error.result')
-rw-r--r-- | mysql-test/r/sp-error.result | 168 |
1 files changed, 154 insertions, 14 deletions
diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index bf25f93cceb..17ab2b79043 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -1,4 +1,5 @@ drop table if exists t1, t2; +SELECT * FROM mysql.proc INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/proc.txt'; delete from mysql.proc; create procedure syntaxerror(t int)| 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 '' at line 1 @@ -142,7 +143,10 @@ declare c cursor for insert into test.t1 values ("foo", 42); open c; close c; end| -ERROR 42000: Cursor statement must be a SELECT +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 'insert into test.t1 values ("foo", 42); +open c; +close c; +end' at line 3 create procedure p() begin declare x int; @@ -292,9 +296,9 @@ call p()| unlock tables| drop procedure p| lock tables t1 read, mysql.proc write| -ERROR HY000: You can't combine write-locking of system 'mysql.proc' table with other tables +ERROR HY000: You can't combine write-locking of system tables with other tables or lock types lock tables mysql.proc write, mysql.user write| -ERROR HY000: You can't combine write-locking of system 'mysql.proc' table with other tables +ERROR HY000: You can't combine write-locking of system tables with other tables or lock types lock tables t1 read, mysql.proc read| unlock tables| lock tables mysql.proc write| @@ -368,7 +372,7 @@ end| insert into t1 values (666, 51.3)| call bug2272()| ERROR 42S22: Unknown column 'v' in 'field list' -delete from t1| +truncate table t1| drop procedure bug2272| create procedure bug2329_1() begin @@ -425,7 +429,7 @@ set y = x; end| set @x = 0| call bug3279(@x)| -ERROR 23000: Duplicate entry '6' for key 1 +ERROR 23000: Duplicate entry '6' for key 'PRIMARY' select @x| @x 0 @@ -520,7 +524,7 @@ declare exit handler for sqlexception select 'Error!'; open c; fetch c into v; end| -delete from t1| +truncate table t1| call bug7299()| ERROR 02000: No data - zero rows fetched, selected, or processed drop procedure bug7299| @@ -621,7 +625,7 @@ val x bug8408() 3 3.14 3 7 7 3 drop function bug8408| -delete from t1| +truncate table t1| drop procedure if exists bug10537| create procedure bug10537() load data local infile '/tmp/somefile' into table t1| @@ -682,8 +686,8 @@ create procedure bug17015_012345678901234567890123456789012345678901234567890123 begin end| show procedure status like 'bug17015%'| -Db Name Type Definer Modified Created Security_type Comment -test bug17015_0123456789012345678901234567890123456789012345678901234 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +test bug17015_0123456789012345678901234567890123456789012345678901234 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci drop procedure bug17015_0123456789012345678901234567890123456789012345678901234| drop procedure if exists bug10969| create procedure bug10969() @@ -969,6 +973,18 @@ CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create user 'mysqltest ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. CREATE FUNCTION bug_13627_f() returns int BEGIN create user 'mysqltest_1'; return 1; END | ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE TRIGGER bug21975 BEFORE INSERT ON t1 FOR EACH ROW BEGIN grant select on t1 to 'mysqltest_1'; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE FUNCTION bug21975() returns int BEGIN grant select on t1 to 'mysqltest_1'; return 1; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE TRIGGER bug21975 BEFORE INSERT ON t1 FOR EACH ROW BEGIN revoke select on t1 from 'mysqltest_1'; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE FUNCTION bug21975() returns int BEGIN revoke select on t1 from 'mysqltest_1'; return 1; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE TRIGGER bug21975 BEFORE INSERT ON t1 FOR EACH ROW BEGIN revoke all privileges on *.* from 'mysqltest_1'; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +CREATE FUNCTION bug21975() returns int BEGIN revoke all privileges on *.* from 'mysqltest_1'; return 1; END | +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop user 'mysqltest_1'; END | ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. CREATE FUNCTION bug_13627_f() returns int BEGIN drop user 'mysqltest_1'; return 1; END | @@ -1030,7 +1046,8 @@ select bug12329(); bug12329() 101 execute stmt1; -ERROR 42S02: Table 'test.t2' doesn't exist +bug12329() +101 deallocate prepare stmt1; drop function bug12329; drop table t1, t2; @@ -1087,8 +1104,8 @@ create procedure p2() select version(); ERROR 3D000: No database selected use mysqltest2; show procedure status; -Db Name Type Definer Modified Created Security_type Comment -mysqltest2 p1 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +mysqltest2 p1 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci drop database mysqltest2; use test; DROP FUNCTION IF EXISTS bug13012| @@ -1177,8 +1194,8 @@ call ` bug15658`(); 1 1 show procedure status; -Db Name Type Definer Modified Created Security_type Comment -test bug15658 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +test bug15658 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci drop procedure ` bug15658`; drop function if exists bug14270; drop table if exists t1; @@ -1400,6 +1417,19 @@ drop table table_25345_b; drop procedure proc_25345; drop function func_25345; drop function func_25345_b; +End of 5.0 tests +drop function if exists bug16164; +create function bug16164() returns int +begin +show authors; +return 42; +end| +ERROR 0A000: Not allowed to return a result set from a function +drop function if exists bug20701; +create function bug20701() returns varchar(25) binary return "test"; +ERROR 42000: This version of MySQL doesn't yet support 'return value collation' +create function bug20701() returns varchar(25) return "test"; +drop function bug20701; create procedure proc_26503_error_1() begin retry: @@ -1452,6 +1482,35 @@ end until true end repeat retry; end// ERROR 42000: LEAVE with no matching label: retry +drop procedure if exists proc_28360; +drop function if exists func_28360; +CREATE PROCEDURE proc_28360() +BEGIN +ALTER DATABASE `#mysql50#upgrade-me` UPGRADE DATA DIRECTORY NAME; +END// +ERROR HY000: Can't drop or alter a DATABASE from within another stored routine +CREATE FUNCTION func_28360() RETURNS int +BEGIN +ALTER DATABASE `#mysql50#upgrade-me` UPGRADE DATA DIRECTORY NAME; +RETURN 0; +END// +ERROR HY000: Can't drop or alter a DATABASE from within another stored routine +DROP PROCEDURE IF EXISTS p1; +CREATE PROCEDURE p1() +BEGIN +DECLARE c char(100); +DECLARE cur1 CURSOR FOR SHOW TABLES; +OPEN cur1; +FETCH cur1 INTO c; +select c; +CLOSE cur1; +END| +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 'SHOW TABLES; +OPEN cur1; +FETCH cur1 INTO c; +select c; +CLOSE cur1; +END' at line 4 DROP DATABASE IF EXISTS mysqltest; CREATE DATABASE mysqltest; USE mysqltest; @@ -1465,6 +1524,63 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp SELECT ..inexistent(); 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 '.inexistent()' at line 1 USE test; +create function f1() returns int +begin +set @test = 1, password = password('foo'); +return 1; +end| +ERROR HY000: Not allowed to set autocommit from a stored function or trigger +create trigger t1 +before insert on t2 for each row set password = password('foo');| +ERROR HY000: Not allowed to set autocommit from a stored function or trigger +drop function if exists f1; +drop function if exists f2; +drop table if exists t1, t2; +create function f1() returns int +begin +drop temporary table t1; +return 1; +end| +create temporary table t1 as select f1(); +ERROR HY000: Can't reopen table: 't1' +create function f2() returns int +begin +create temporary table t2 as select f1(); +return 1; +end| +create temporary table t1 as select f2(); +ERROR HY000: Can't reopen table: 't1' +drop function f1; +drop function f2; +create function f1() returns int +begin +drop temporary table t2,t1; +return 1; +end| +create function f2() returns int +begin +create temporary table t2 as select f1(); +return 1; +end| +create temporary table t1 as select f2(); +ERROR HY000: Can't reopen table: 't2' +drop function f1; +drop function f2; +create temporary table t2(a int); +select * from t2; +a +create function f2() returns int +begin +drop temporary table t2; +return 1; +end| +select f2(); +f2() +1 +drop function f2; +drop table t2; +ERROR 42S02: Unknown table 't2' +End of 5.1 tests drop procedure if exists proc_33983_a; drop procedure if exists proc_33983_b; drop procedure if exists proc_33983_c; @@ -1520,6 +1636,30 @@ CALL p1((SELECT * FROM t1))| ERROR 21000: Subquery returns more than 1 row DROP PROCEDURE IF EXISTS p1| DROP TABLE t1| +drop procedure if exists p1; +create procedure p1() +begin +create table t1 (a int) type=MyISAM; +drop table t1; +end| +Warnings: +Warning 1287 The syntax 'TYPE=storage_engine' is deprecated and will be removed in MySQL 6.0. Please use 'ENGINE=storage_engine' instead +call p1(); +call p1(); +drop procedure p1; +drop procedure if exists proc_8759; +create procedure proc_8759() +begin +declare should_be_illegal condition for sqlstate '00000'; +declare continue handler for should_be_illegal set @x=0; +end$$ +ERROR 42000: Bad SQLSTATE: '00000' +create procedure proc_8759() +begin +declare continue handler for sqlstate '00000' set @x=0; +end$$ +ERROR 42000: Bad SQLSTATE: '00000' +LOAD DATA INFILE '../../tmp/proc.txt' INTO TABLE mysql.proc; CREATE TABLE t1 (a INT, b INT); INSERT INTO t1 VALUES (1,1), (2,2); SELECT MAX (a) FROM t1 WHERE b = 999999; |