Loading mysql-test/r/ps.result +46 −0 Original line number Diff line number Diff line Loading @@ -880,3 +880,49 @@ select row_count(); row_count() 1 drop table t1; create table t1 (a int, b int); insert into t1 (a,b) values (2,8),(1,9),(3,7); prepare stmt from "select * from t1 order by ?"; execute stmt using @a; a b 2 8 1 9 3 7 set @a=1; execute stmt using @a; a b 1 9 2 8 3 7 set @a=2; execute stmt using @a; a b 3 7 2 8 1 9 deallocate prepare stmt; select * from t1 order by 1; a b 1 9 2 8 3 7 prepare stmt from "select * from t1 order by ?+1"; set @a=0; execute stmt using @a; a b 2 8 1 9 3 7 set @a=1; execute stmt using @a; a b 2 8 1 9 3 7 deallocate prepare stmt; select * from t1 order by 1+1; a b 2 8 1 9 3 7 drop table t1; mysql-test/r/sp-error.result +10 −2 Original line number Diff line number Diff line Loading @@ -634,10 +634,18 @@ flush tables; return 5; end| ERROR 0A000: FLUSH is not allowed in stored function or trigger create procedure bug9529_90123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123() create procedure bug9529_901234567890123456789012345678901234567890123456789012345() begin end| ERROR 42000: Identifier name 'bug9529_90123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890' is too long ERROR 42000: Identifier name 'bug9529_901234567890123456789012345678901234567890123456789012345' is too long drop procedure if exists bug17015_0123456789012345678901234567890123456789012345678901234| create procedure bug17015_0123456789012345678901234567890123456789012345678901234() 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 drop procedure bug17015_0123456789012345678901234567890123456789012345678901234| drop procedure if exists bug10969| create procedure bug10969() begin Loading mysql-test/r/sp-prelocking.result +23 −0 Original line number Diff line number Diff line Loading @@ -214,3 +214,26 @@ drop function f1; drop function f2; drop function f3; drop procedure sp1; drop table if exists t1; drop view if exists v1, v2, v3; drop function if exists bug15683; create table t1 (f1 bigint, f2 varchar(20), f3 bigint); insert into t1 set f1 = 1, f2 = 'schoenenbourg', f3 = 1; create view v1 as select 1 from t1 union all select 1; create view v2 as select 1 from v1; create view v3 as select 1 as f1 from v2; create function bug15683() returns bigint begin return (select count(*) from v3); end| prepare stmt from "select bug15683()"; execute stmt; bug15683() 2 execute stmt; bug15683() 2 deallocate prepare stmt; drop table t1; drop view v1, v2, v3; drop function bug15683; mysql-test/r/sp.result +35 −0 Original line number Diff line number Diff line Loading @@ -4802,4 +4802,39 @@ f1 bug13575(f1) 3 ccc drop function bug13575; drop table t3| drop procedure if exists bug16474_1| drop procedure if exists bug16474_2| delete from t1| insert into t1 values ('c', 2), ('b', 3), ('a', 1)| create procedure bug16474_1() begin declare x int; select id from t1 order by x; end| create procedure bug16474_2(x int) select id from t1 order by x| call bug16474_1()| id c b a call bug16474_2(1)| id c b a call bug16474_2(2)| id c b a drop procedure bug16474_1| drop procedure bug16474_2| set @x = 2| select * from t1 order by @x| id data c 2 b 3 a 1 delete from t1| drop table t1,t2; mysql-test/r/trigger.result +24 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ drop table if exists t1, t2, t3, t4; drop view if exists v1; drop database if exists mysqltest; drop function if exists f1; drop function if exists f2; drop procedure if exists p1; create table t1 (i int); create trigger trg before insert on t1 for each row set @a:=1; Loading Loading @@ -928,3 +929,26 @@ create trigger t1_bi before insert on t1 for each row return 0; ERROR 42000: RETURN is only allowed in a FUNCTION insert into t1 values (1); drop table t1; create table t1 (a varchar(64), b int); create table t2 like t1; create trigger t1_ai after insert on t1 for each row set @a:= (select max(a) from t1); insert into t1 (a) values ("Twas"),("brillig"),("and"),("the"),("slithy"),("toves"), ("Did"),("gyre"),("and"),("gimble"),("in"),("the"),("wabe"); create trigger t2_ai after insert on t2 for each row set @a:= (select max(a) from t2); insert into t2 select * from t1; load data infile '../std_data_ln/words.dat' into table t1 (a); drop trigger t1_ai; drop trigger t2_ai; create function f1() returns int return (select max(b) from t1); insert into t1 values ("All",f1()),("mimsy",f1()),("were",f1()),("the",f1()),("borogoves",f1()), ("And",f1()),("the",f1()),("mome", f1()),("raths",f1()),("outgrabe",f1()); create function f2() returns int return (select max(b) from t2); insert into t2 select a, f2() from t1; load data infile '../std_data_ln/words.dat' into table t1 (a) set b:= f1(); drop table t1; drop function f1; drop function f2; Loading
mysql-test/r/ps.result +46 −0 Original line number Diff line number Diff line Loading @@ -880,3 +880,49 @@ select row_count(); row_count() 1 drop table t1; create table t1 (a int, b int); insert into t1 (a,b) values (2,8),(1,9),(3,7); prepare stmt from "select * from t1 order by ?"; execute stmt using @a; a b 2 8 1 9 3 7 set @a=1; execute stmt using @a; a b 1 9 2 8 3 7 set @a=2; execute stmt using @a; a b 3 7 2 8 1 9 deallocate prepare stmt; select * from t1 order by 1; a b 1 9 2 8 3 7 prepare stmt from "select * from t1 order by ?+1"; set @a=0; execute stmt using @a; a b 2 8 1 9 3 7 set @a=1; execute stmt using @a; a b 2 8 1 9 3 7 deallocate prepare stmt; select * from t1 order by 1+1; a b 2 8 1 9 3 7 drop table t1;
mysql-test/r/sp-error.result +10 −2 Original line number Diff line number Diff line Loading @@ -634,10 +634,18 @@ flush tables; return 5; end| ERROR 0A000: FLUSH is not allowed in stored function or trigger create procedure bug9529_90123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123() create procedure bug9529_901234567890123456789012345678901234567890123456789012345() begin end| ERROR 42000: Identifier name 'bug9529_90123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890' is too long ERROR 42000: Identifier name 'bug9529_901234567890123456789012345678901234567890123456789012345' is too long drop procedure if exists bug17015_0123456789012345678901234567890123456789012345678901234| create procedure bug17015_0123456789012345678901234567890123456789012345678901234() 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 drop procedure bug17015_0123456789012345678901234567890123456789012345678901234| drop procedure if exists bug10969| create procedure bug10969() begin Loading
mysql-test/r/sp-prelocking.result +23 −0 Original line number Diff line number Diff line Loading @@ -214,3 +214,26 @@ drop function f1; drop function f2; drop function f3; drop procedure sp1; drop table if exists t1; drop view if exists v1, v2, v3; drop function if exists bug15683; create table t1 (f1 bigint, f2 varchar(20), f3 bigint); insert into t1 set f1 = 1, f2 = 'schoenenbourg', f3 = 1; create view v1 as select 1 from t1 union all select 1; create view v2 as select 1 from v1; create view v3 as select 1 as f1 from v2; create function bug15683() returns bigint begin return (select count(*) from v3); end| prepare stmt from "select bug15683()"; execute stmt; bug15683() 2 execute stmt; bug15683() 2 deallocate prepare stmt; drop table t1; drop view v1, v2, v3; drop function bug15683;
mysql-test/r/sp.result +35 −0 Original line number Diff line number Diff line Loading @@ -4802,4 +4802,39 @@ f1 bug13575(f1) 3 ccc drop function bug13575; drop table t3| drop procedure if exists bug16474_1| drop procedure if exists bug16474_2| delete from t1| insert into t1 values ('c', 2), ('b', 3), ('a', 1)| create procedure bug16474_1() begin declare x int; select id from t1 order by x; end| create procedure bug16474_2(x int) select id from t1 order by x| call bug16474_1()| id c b a call bug16474_2(1)| id c b a call bug16474_2(2)| id c b a drop procedure bug16474_1| drop procedure bug16474_2| set @x = 2| select * from t1 order by @x| id data c 2 b 3 a 1 delete from t1| drop table t1,t2;
mysql-test/r/trigger.result +24 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ drop table if exists t1, t2, t3, t4; drop view if exists v1; drop database if exists mysqltest; drop function if exists f1; drop function if exists f2; drop procedure if exists p1; create table t1 (i int); create trigger trg before insert on t1 for each row set @a:=1; Loading Loading @@ -928,3 +929,26 @@ create trigger t1_bi before insert on t1 for each row return 0; ERROR 42000: RETURN is only allowed in a FUNCTION insert into t1 values (1); drop table t1; create table t1 (a varchar(64), b int); create table t2 like t1; create trigger t1_ai after insert on t1 for each row set @a:= (select max(a) from t1); insert into t1 (a) values ("Twas"),("brillig"),("and"),("the"),("slithy"),("toves"), ("Did"),("gyre"),("and"),("gimble"),("in"),("the"),("wabe"); create trigger t2_ai after insert on t2 for each row set @a:= (select max(a) from t2); insert into t2 select * from t1; load data infile '../std_data_ln/words.dat' into table t1 (a); drop trigger t1_ai; drop trigger t2_ai; create function f1() returns int return (select max(b) from t1); insert into t1 values ("All",f1()),("mimsy",f1()),("were",f1()),("the",f1()),("borogoves",f1()), ("And",f1()),("the",f1()),("mome", f1()),("raths",f1()),("outgrabe",f1()); create function f2() returns int return (select max(b) from t2); insert into t2 select a, f2() from t1; load data infile '../std_data_ln/words.dat' into table t1 (a) set b:= f1(); drop table t1; drop function f1; drop function f2;