Loading mysql-test/include/ps_query.inc +21 −21 Original line number Diff line number Diff line Loading @@ -104,13 +104,13 @@ prepare stmt1 from ' select substr(''MySQL'',1,?) from t1 where a=1 ' ; execute stmt1 using @arg00 ; # variations on 'concat' set @arg00='MySQL' ; select a , concat(@arg00,b) from t1 ; select a , concat(@arg00,b) from t1 order by a; # BUG#3796 Prepared statement, select concat(<parameter>,<column>),wrong result prepare stmt1 from ' select a , concat(?,b) from t1 ' ; prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ; execute stmt1 using @arg00; # select a , concat(b,@arg00) from t1 ; prepare stmt1 from ' select a , concat(b,?) from t1 ' ; select a , concat(b,@arg00) from t1 order by a ; prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ; execute stmt1 using @arg00; # variations on 'group_concat' Loading Loading @@ -147,7 +147,7 @@ create table t5 (id1 int(11) not null default '0', value2 varchar(100), value1 varchar(100)) ; insert into t5 values (1,'hh','hh'),(2,'hh','hh'), (1,'ii','ii'),(2,'ii','ii') ; prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? ' ; prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ; set @arg00=1 ; set @arg01='hh' ; execute stmt1 using @arg00, @arg01 ; Loading Loading @@ -216,8 +216,8 @@ execute stmt1 using @arg00 ; # parameter in IN set @arg00=2 ; set @arg01=3 ; select a FROM t1 where a in (@arg00,@arg01); prepare stmt1 from ' select a FROM t1 where a in (?,?) '; select a FROM t1 where a in (@arg00,@arg01) order by a; prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a '; execute stmt1 using @arg00, @arg01; # case derived from client_test.c: test_bug1500() set @arg00= 'one' ; Loading Loading @@ -270,9 +270,9 @@ execute stmt1 using @arg00 ; ##### parameter used in having clause set @arg00='two' ; select a,b FROM t1 where a is not NULL AND b is not NULL having b <> @arg00 ; AND b is not NULL having b <> @arg00 order by a ; prepare stmt1 from ' select a,b FROM t1 where a is not NULL AND b is not NULL having b <> ? ' ; AND b is not NULL having b <> ? order by a ' ; execute stmt1 using @arg00 ; ##### parameter used in order clause Loading Loading @@ -327,10 +327,10 @@ select '------ join tests ------' as test_sequence ; # no parameter select first.a as a1, second.a as a2 from t1 first, t1 second where first.a = second.a ; where first.a = second.a order by a1 ; prepare stmt1 from ' select first.a as a1, second.a as a2 from t1 first, t1 second where first.a = second.a '; where first.a = second.a order by a1 '; execute stmt1 ; # some parameters Loading @@ -350,15 +350,15 @@ execute stmt1 using @arg00, @arg01, @arg02; drop table if exists t2 ; --enable_warnings create table t2 as select * from t1 ; set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) ' ; set @query2= 'SELECT * FROM t2 natural join t1 ' ; set @query3= 'SELECT * FROM t2 join t1 using(a) ' ; set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) ' ; set @query5= 'SELECT * FROM t2 natural left join t1 ' ; set @query6= 'SELECT * FROM t2 left join t1 using(a) ' ; set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) ' ; set @query8= 'SELECT * FROM t2 natural right join t1 ' ; set @query9= 'SELECT * FROM t2 right join t1 using(a) ' ; set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ; set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ; set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ; set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ; set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ; set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ; set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ; set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ; set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ; let $1= 9 ; while ($1) { Loading Loading @@ -424,7 +424,7 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; ######## correlated subquery # no parameter prepare stmt1 from ' select a, b FROM t1 outer_table where a = (select a from t1 where b = outer_table.b ) '; a = (select a from t1 where b = outer_table.b ) order by a '; # also Bug#4000 (only BDB tables) # Bug#4106 : ndb table, query with correlated subquery, wrong result execute stmt1 ; Loading mysql-test/r/ps_2myisam.result +31 −31 Original line number Diff line number Diff line Loading @@ -165,26 +165,26 @@ execute stmt1 using @arg00 ; substr('MySQL',1,?) MyS set @arg00='MySQL' ; select a , concat(@arg00,b) from t1 ; select a , concat(@arg00,b) from t1 order by a; a concat(@arg00,b) 1 MySQLone 2 MySQLtwo 3 MySQLthree 4 MySQLfour prepare stmt1 from ' select a , concat(?,b) from t1 ' ; prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ; execute stmt1 using @arg00; a concat(?,b) 1 MySQLone 2 MySQLtwo 3 MySQLthree 4 MySQLfour select a , concat(b,@arg00) from t1 ; select a , concat(b,@arg00) from t1 order by a ; a concat(b,@arg00) 1 oneMySQL 2 twoMySQL 3 threeMySQL 4 fourMySQL prepare stmt1 from ' select a , concat(b,?) from t1 ' ; prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ; execute stmt1 using @arg00; a concat(b,?) 1 oneMySQL Loading Loading @@ -234,14 +234,14 @@ create table t5 (id1 int(11) not null default '0', value2 varchar(100), value1 varchar(100)) ; insert into t5 values (1,'hh','hh'),(2,'hh','hh'), (1,'ii','ii'),(2,'ii','ii') ; prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? ' ; prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ; set @arg00=1 ; set @arg01='hh' ; execute stmt1 using @arg00, @arg01 ; id1 value1 1 hh 2 hh 1 ii 2 hh drop table t5 ; drop table if exists t5 ; create table t5(session_id char(9) not null) ; Loading Loading @@ -307,11 +307,11 @@ execute stmt1 using @arg00 ; a set @arg00=2 ; set @arg01=3 ; select a FROM t1 where a in (@arg00,@arg01); select a FROM t1 where a in (@arg00,@arg01) order by a; a 2 3 prepare stmt1 from ' select a FROM t1 where a in (?,?) '; prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a '; execute stmt1 using @arg00, @arg01; a 2 Loading Loading @@ -385,13 +385,13 @@ a b 4 four set @arg00='two' ; select a,b FROM t1 where a is not NULL AND b is not NULL having b <> @arg00 ; AND b is not NULL having b <> @arg00 order by a ; a b 1 one 3 three 4 four prepare stmt1 from ' select a,b FROM t1 where a is not NULL AND b is not NULL having b <> ? ' ; AND b is not NULL having b <> ? order by a ' ; execute stmt1 using @arg00 ; a b 1 one Loading Loading @@ -470,7 +470,7 @@ test_sequence ------ join tests ------ select first.a as a1, second.a as a2 from t1 first, t1 second where first.a = second.a ; where first.a = second.a order by a1 ; a1 a2 1 1 2 2 Loading @@ -478,7 +478,7 @@ a1 a2 4 4 prepare stmt1 from ' select first.a as a1, second.a as a2 from t1 first, t1 second where first.a = second.a '; where first.a = second.a order by a1 '; execute stmt1 ; a1 a2 1 1 Loading Loading @@ -517,17 +517,17 @@ a ? a 4 ABC 4 drop table if exists t2 ; create table t2 as select * from t1 ; set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) ' ; set @query2= 'SELECT * FROM t2 natural join t1 ' ; set @query3= 'SELECT * FROM t2 join t1 using(a) ' ; set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) ' ; set @query5= 'SELECT * FROM t2 natural left join t1 ' ; set @query6= 'SELECT * FROM t2 left join t1 using(a) ' ; set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) ' ; set @query8= 'SELECT * FROM t2 natural right join t1 ' ; set @query9= 'SELECT * FROM t2 right join t1 using(a) ' ; set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ; set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ; set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ; set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ; set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ; set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ; set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ; set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ; set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ; the join statement is: SELECT * FROM t2 right join t1 using(a) SELECT * FROM t2 right join t1 using(a) order by t2.a prepare stmt1 from @query9 ; execute stmt1 ; a b a b Loading @@ -548,7 +548,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 natural right join t1 SELECT * FROM t2 natural right join t1 order by t2.a prepare stmt1 from @query8 ; execute stmt1 ; a b a b Loading @@ -569,7 +569,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 right join t1 on(t1.a=t2.a) SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a prepare stmt1 from @query7 ; execute stmt1 ; a b a b Loading @@ -590,7 +590,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 left join t1 using(a) SELECT * FROM t2 left join t1 using(a) order by t2.a prepare stmt1 from @query6 ; execute stmt1 ; a b a b Loading @@ -611,7 +611,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 natural left join t1 SELECT * FROM t2 natural left join t1 order by t2.a prepare stmt1 from @query5 ; execute stmt1 ; a b a b Loading @@ -632,7 +632,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 left join t1 on(t1.a=t2.a) SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a prepare stmt1 from @query4 ; execute stmt1 ; a b a b Loading @@ -653,7 +653,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 join t1 using(a) SELECT * FROM t2 join t1 using(a) order by t2.a prepare stmt1 from @query3 ; execute stmt1 ; a b a b Loading @@ -674,7 +674,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 natural join t1 SELECT * FROM t2 natural join t1 order by t2.a prepare stmt1 from @query2 ; execute stmt1 ; a b Loading @@ -695,7 +695,7 @@ a b 3 three 4 four the join statement is: SELECT * FROM t2 join t1 on (t1.a=t2.a) SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a prepare stmt1 from @query1 ; execute stmt1 ; a b a b Loading Loading @@ -769,7 +769,7 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; a ? b 2 1 two prepare stmt1 from ' select a, b FROM t1 outer_table where a = (select a from t1 where b = outer_table.b ) '; a = (select a from t1 where b = outer_table.b ) order by a '; execute stmt1 ; a b 1 one Loading mysql-test/r/ps_3innodb.result +31 −31 Original line number Diff line number Diff line Loading @@ -165,26 +165,26 @@ execute stmt1 using @arg00 ; substr('MySQL',1,?) MyS set @arg00='MySQL' ; select a , concat(@arg00,b) from t1 ; select a , concat(@arg00,b) from t1 order by a; a concat(@arg00,b) 1 MySQLone 2 MySQLtwo 3 MySQLthree 4 MySQLfour prepare stmt1 from ' select a , concat(?,b) from t1 ' ; prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ; execute stmt1 using @arg00; a concat(?,b) 1 MySQLone 2 MySQLtwo 3 MySQLthree 4 MySQLfour select a , concat(b,@arg00) from t1 ; select a , concat(b,@arg00) from t1 order by a ; a concat(b,@arg00) 1 oneMySQL 2 twoMySQL 3 threeMySQL 4 fourMySQL prepare stmt1 from ' select a , concat(b,?) from t1 ' ; prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ; execute stmt1 using @arg00; a concat(b,?) 1 oneMySQL Loading Loading @@ -234,14 +234,14 @@ create table t5 (id1 int(11) not null default '0', value2 varchar(100), value1 varchar(100)) ; insert into t5 values (1,'hh','hh'),(2,'hh','hh'), (1,'ii','ii'),(2,'ii','ii') ; prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? ' ; prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ; set @arg00=1 ; set @arg01='hh' ; execute stmt1 using @arg00, @arg01 ; id1 value1 1 hh 2 hh 1 ii 2 hh drop table t5 ; drop table if exists t5 ; create table t5(session_id char(9) not null) ; Loading Loading @@ -307,11 +307,11 @@ execute stmt1 using @arg00 ; a set @arg00=2 ; set @arg01=3 ; select a FROM t1 where a in (@arg00,@arg01); select a FROM t1 where a in (@arg00,@arg01) order by a; a 2 3 prepare stmt1 from ' select a FROM t1 where a in (?,?) '; prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a '; execute stmt1 using @arg00, @arg01; a 2 Loading Loading @@ -385,13 +385,13 @@ a b 4 four set @arg00='two' ; select a,b FROM t1 where a is not NULL AND b is not NULL having b <> @arg00 ; AND b is not NULL having b <> @arg00 order by a ; a b 1 one 3 three 4 four prepare stmt1 from ' select a,b FROM t1 where a is not NULL AND b is not NULL having b <> ? ' ; AND b is not NULL having b <> ? order by a ' ; execute stmt1 using @arg00 ; a b 1 one Loading Loading @@ -470,7 +470,7 @@ test_sequence ------ join tests ------ select first.a as a1, second.a as a2 from t1 first, t1 second where first.a = second.a ; where first.a = second.a order by a1 ; a1 a2 1 1 2 2 Loading @@ -478,7 +478,7 @@ a1 a2 4 4 prepare stmt1 from ' select first.a as a1, second.a as a2 from t1 first, t1 second where first.a = second.a '; where first.a = second.a order by a1 '; execute stmt1 ; a1 a2 1 1 Loading Loading @@ -517,17 +517,17 @@ a ? a 4 ABC 4 drop table if exists t2 ; create table t2 as select * from t1 ; set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) ' ; set @query2= 'SELECT * FROM t2 natural join t1 ' ; set @query3= 'SELECT * FROM t2 join t1 using(a) ' ; set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) ' ; set @query5= 'SELECT * FROM t2 natural left join t1 ' ; set @query6= 'SELECT * FROM t2 left join t1 using(a) ' ; set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) ' ; set @query8= 'SELECT * FROM t2 natural right join t1 ' ; set @query9= 'SELECT * FROM t2 right join t1 using(a) ' ; set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ; set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ; set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ; set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ; set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ; set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ; set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ; set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ; set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ; the join statement is: SELECT * FROM t2 right join t1 using(a) SELECT * FROM t2 right join t1 using(a) order by t2.a prepare stmt1 from @query9 ; execute stmt1 ; a b a b Loading @@ -548,7 +548,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 natural right join t1 SELECT * FROM t2 natural right join t1 order by t2.a prepare stmt1 from @query8 ; execute stmt1 ; a b a b Loading @@ -569,7 +569,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 right join t1 on(t1.a=t2.a) SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a prepare stmt1 from @query7 ; execute stmt1 ; a b a b Loading @@ -590,7 +590,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 left join t1 using(a) SELECT * FROM t2 left join t1 using(a) order by t2.a prepare stmt1 from @query6 ; execute stmt1 ; a b a b Loading @@ -611,7 +611,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 natural left join t1 SELECT * FROM t2 natural left join t1 order by t2.a prepare stmt1 from @query5 ; execute stmt1 ; a b a b Loading @@ -632,7 +632,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 left join t1 on(t1.a=t2.a) SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a prepare stmt1 from @query4 ; execute stmt1 ; a b a b Loading @@ -653,7 +653,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 join t1 using(a) SELECT * FROM t2 join t1 using(a) order by t2.a prepare stmt1 from @query3 ; execute stmt1 ; a b a b Loading @@ -674,7 +674,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 natural join t1 SELECT * FROM t2 natural join t1 order by t2.a prepare stmt1 from @query2 ; execute stmt1 ; a b Loading @@ -695,7 +695,7 @@ a b 3 three 4 four the join statement is: SELECT * FROM t2 join t1 on (t1.a=t2.a) SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a prepare stmt1 from @query1 ; execute stmt1 ; a b a b Loading Loading @@ -769,7 +769,7 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; a ? b 2 1 two prepare stmt1 from ' select a, b FROM t1 outer_table where a = (select a from t1 where b = outer_table.b ) '; a = (select a from t1 where b = outer_table.b ) order by a '; execute stmt1 ; a b 1 one Loading mysql-test/r/ps_4heap.result +31 −31 Original line number Diff line number Diff line Loading @@ -166,26 +166,26 @@ execute stmt1 using @arg00 ; substr('MySQL',1,?) MyS set @arg00='MySQL' ; select a , concat(@arg00,b) from t1 ; select a , concat(@arg00,b) from t1 order by a; a concat(@arg00,b) 1 MySQLone 2 MySQLtwo 3 MySQLthree 4 MySQLfour prepare stmt1 from ' select a , concat(?,b) from t1 ' ; prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ; execute stmt1 using @arg00; a concat(?,b) 1 MySQLone 2 MySQLtwo 3 MySQLthree 4 MySQLfour select a , concat(b,@arg00) from t1 ; select a , concat(b,@arg00) from t1 order by a ; a concat(b,@arg00) 1 oneMySQL 2 twoMySQL 3 threeMySQL 4 fourMySQL prepare stmt1 from ' select a , concat(b,?) from t1 ' ; prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ; execute stmt1 using @arg00; a concat(b,?) 1 oneMySQL Loading Loading @@ -235,14 +235,14 @@ create table t5 (id1 int(11) not null default '0', value2 varchar(100), value1 varchar(100)) ; insert into t5 values (1,'hh','hh'),(2,'hh','hh'), (1,'ii','ii'),(2,'ii','ii') ; prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? ' ; prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ; set @arg00=1 ; set @arg01='hh' ; execute stmt1 using @arg00, @arg01 ; id1 value1 1 hh 2 hh 1 ii 2 hh drop table t5 ; drop table if exists t5 ; create table t5(session_id char(9) not null) ; Loading Loading @@ -308,11 +308,11 @@ execute stmt1 using @arg00 ; a set @arg00=2 ; set @arg01=3 ; select a FROM t1 where a in (@arg00,@arg01); select a FROM t1 where a in (@arg00,@arg01) order by a; a 2 3 prepare stmt1 from ' select a FROM t1 where a in (?,?) '; prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a '; execute stmt1 using @arg00, @arg01; a 2 Loading Loading @@ -386,13 +386,13 @@ a b 4 four set @arg00='two' ; select a,b FROM t1 where a is not NULL AND b is not NULL having b <> @arg00 ; AND b is not NULL having b <> @arg00 order by a ; a b 1 one 3 three 4 four prepare stmt1 from ' select a,b FROM t1 where a is not NULL AND b is not NULL having b <> ? ' ; AND b is not NULL having b <> ? order by a ' ; execute stmt1 using @arg00 ; a b 1 one Loading Loading @@ -471,7 +471,7 @@ test_sequence ------ join tests ------ select first.a as a1, second.a as a2 from t1 first, t1 second where first.a = second.a ; where first.a = second.a order by a1 ; a1 a2 1 1 2 2 Loading @@ -479,7 +479,7 @@ a1 a2 4 4 prepare stmt1 from ' select first.a as a1, second.a as a2 from t1 first, t1 second where first.a = second.a '; where first.a = second.a order by a1 '; execute stmt1 ; a1 a2 1 1 Loading Loading @@ -518,17 +518,17 @@ a ? a 4 ABC 4 drop table if exists t2 ; create table t2 as select * from t1 ; set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) ' ; set @query2= 'SELECT * FROM t2 natural join t1 ' ; set @query3= 'SELECT * FROM t2 join t1 using(a) ' ; set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) ' ; set @query5= 'SELECT * FROM t2 natural left join t1 ' ; set @query6= 'SELECT * FROM t2 left join t1 using(a) ' ; set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) ' ; set @query8= 'SELECT * FROM t2 natural right join t1 ' ; set @query9= 'SELECT * FROM t2 right join t1 using(a) ' ; set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ; set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ; set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ; set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ; set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ; set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ; set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ; set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ; set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ; the join statement is: SELECT * FROM t2 right join t1 using(a) SELECT * FROM t2 right join t1 using(a) order by t2.a prepare stmt1 from @query9 ; execute stmt1 ; a b a b Loading @@ -549,7 +549,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 natural right join t1 SELECT * FROM t2 natural right join t1 order by t2.a prepare stmt1 from @query8 ; execute stmt1 ; a b a b Loading @@ -570,7 +570,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 right join t1 on(t1.a=t2.a) SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a prepare stmt1 from @query7 ; execute stmt1 ; a b a b Loading @@ -591,7 +591,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 left join t1 using(a) SELECT * FROM t2 left join t1 using(a) order by t2.a prepare stmt1 from @query6 ; execute stmt1 ; a b a b Loading @@ -612,7 +612,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 natural left join t1 SELECT * FROM t2 natural left join t1 order by t2.a prepare stmt1 from @query5 ; execute stmt1 ; a b a b Loading @@ -633,7 +633,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 left join t1 on(t1.a=t2.a) SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a prepare stmt1 from @query4 ; execute stmt1 ; a b a b Loading @@ -654,7 +654,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 join t1 using(a) SELECT * FROM t2 join t1 using(a) order by t2.a prepare stmt1 from @query3 ; execute stmt1 ; a b a b Loading @@ -675,7 +675,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 natural join t1 SELECT * FROM t2 natural join t1 order by t2.a prepare stmt1 from @query2 ; execute stmt1 ; a b Loading @@ -696,7 +696,7 @@ a b 3 three 4 four the join statement is: SELECT * FROM t2 join t1 on (t1.a=t2.a) SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a prepare stmt1 from @query1 ; execute stmt1 ; a b a b Loading Loading @@ -770,7 +770,7 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; a ? b 2 1 two prepare stmt1 from ' select a, b FROM t1 outer_table where a = (select a from t1 where b = outer_table.b ) '; a = (select a from t1 where b = outer_table.b ) order by a '; execute stmt1 ; a b 1 one Loading mysql-test/r/ps_5merge.result +62 −62 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
mysql-test/include/ps_query.inc +21 −21 Original line number Diff line number Diff line Loading @@ -104,13 +104,13 @@ prepare stmt1 from ' select substr(''MySQL'',1,?) from t1 where a=1 ' ; execute stmt1 using @arg00 ; # variations on 'concat' set @arg00='MySQL' ; select a , concat(@arg00,b) from t1 ; select a , concat(@arg00,b) from t1 order by a; # BUG#3796 Prepared statement, select concat(<parameter>,<column>),wrong result prepare stmt1 from ' select a , concat(?,b) from t1 ' ; prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ; execute stmt1 using @arg00; # select a , concat(b,@arg00) from t1 ; prepare stmt1 from ' select a , concat(b,?) from t1 ' ; select a , concat(b,@arg00) from t1 order by a ; prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ; execute stmt1 using @arg00; # variations on 'group_concat' Loading Loading @@ -147,7 +147,7 @@ create table t5 (id1 int(11) not null default '0', value2 varchar(100), value1 varchar(100)) ; insert into t5 values (1,'hh','hh'),(2,'hh','hh'), (1,'ii','ii'),(2,'ii','ii') ; prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? ' ; prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ; set @arg00=1 ; set @arg01='hh' ; execute stmt1 using @arg00, @arg01 ; Loading Loading @@ -216,8 +216,8 @@ execute stmt1 using @arg00 ; # parameter in IN set @arg00=2 ; set @arg01=3 ; select a FROM t1 where a in (@arg00,@arg01); prepare stmt1 from ' select a FROM t1 where a in (?,?) '; select a FROM t1 where a in (@arg00,@arg01) order by a; prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a '; execute stmt1 using @arg00, @arg01; # case derived from client_test.c: test_bug1500() set @arg00= 'one' ; Loading Loading @@ -270,9 +270,9 @@ execute stmt1 using @arg00 ; ##### parameter used in having clause set @arg00='two' ; select a,b FROM t1 where a is not NULL AND b is not NULL having b <> @arg00 ; AND b is not NULL having b <> @arg00 order by a ; prepare stmt1 from ' select a,b FROM t1 where a is not NULL AND b is not NULL having b <> ? ' ; AND b is not NULL having b <> ? order by a ' ; execute stmt1 using @arg00 ; ##### parameter used in order clause Loading Loading @@ -327,10 +327,10 @@ select '------ join tests ------' as test_sequence ; # no parameter select first.a as a1, second.a as a2 from t1 first, t1 second where first.a = second.a ; where first.a = second.a order by a1 ; prepare stmt1 from ' select first.a as a1, second.a as a2 from t1 first, t1 second where first.a = second.a '; where first.a = second.a order by a1 '; execute stmt1 ; # some parameters Loading @@ -350,15 +350,15 @@ execute stmt1 using @arg00, @arg01, @arg02; drop table if exists t2 ; --enable_warnings create table t2 as select * from t1 ; set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) ' ; set @query2= 'SELECT * FROM t2 natural join t1 ' ; set @query3= 'SELECT * FROM t2 join t1 using(a) ' ; set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) ' ; set @query5= 'SELECT * FROM t2 natural left join t1 ' ; set @query6= 'SELECT * FROM t2 left join t1 using(a) ' ; set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) ' ; set @query8= 'SELECT * FROM t2 natural right join t1 ' ; set @query9= 'SELECT * FROM t2 right join t1 using(a) ' ; set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ; set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ; set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ; set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ; set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ; set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ; set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ; set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ; set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ; let $1= 9 ; while ($1) { Loading Loading @@ -424,7 +424,7 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; ######## correlated subquery # no parameter prepare stmt1 from ' select a, b FROM t1 outer_table where a = (select a from t1 where b = outer_table.b ) '; a = (select a from t1 where b = outer_table.b ) order by a '; # also Bug#4000 (only BDB tables) # Bug#4106 : ndb table, query with correlated subquery, wrong result execute stmt1 ; Loading
mysql-test/r/ps_2myisam.result +31 −31 Original line number Diff line number Diff line Loading @@ -165,26 +165,26 @@ execute stmt1 using @arg00 ; substr('MySQL',1,?) MyS set @arg00='MySQL' ; select a , concat(@arg00,b) from t1 ; select a , concat(@arg00,b) from t1 order by a; a concat(@arg00,b) 1 MySQLone 2 MySQLtwo 3 MySQLthree 4 MySQLfour prepare stmt1 from ' select a , concat(?,b) from t1 ' ; prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ; execute stmt1 using @arg00; a concat(?,b) 1 MySQLone 2 MySQLtwo 3 MySQLthree 4 MySQLfour select a , concat(b,@arg00) from t1 ; select a , concat(b,@arg00) from t1 order by a ; a concat(b,@arg00) 1 oneMySQL 2 twoMySQL 3 threeMySQL 4 fourMySQL prepare stmt1 from ' select a , concat(b,?) from t1 ' ; prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ; execute stmt1 using @arg00; a concat(b,?) 1 oneMySQL Loading Loading @@ -234,14 +234,14 @@ create table t5 (id1 int(11) not null default '0', value2 varchar(100), value1 varchar(100)) ; insert into t5 values (1,'hh','hh'),(2,'hh','hh'), (1,'ii','ii'),(2,'ii','ii') ; prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? ' ; prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ; set @arg00=1 ; set @arg01='hh' ; execute stmt1 using @arg00, @arg01 ; id1 value1 1 hh 2 hh 1 ii 2 hh drop table t5 ; drop table if exists t5 ; create table t5(session_id char(9) not null) ; Loading Loading @@ -307,11 +307,11 @@ execute stmt1 using @arg00 ; a set @arg00=2 ; set @arg01=3 ; select a FROM t1 where a in (@arg00,@arg01); select a FROM t1 where a in (@arg00,@arg01) order by a; a 2 3 prepare stmt1 from ' select a FROM t1 where a in (?,?) '; prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a '; execute stmt1 using @arg00, @arg01; a 2 Loading Loading @@ -385,13 +385,13 @@ a b 4 four set @arg00='two' ; select a,b FROM t1 where a is not NULL AND b is not NULL having b <> @arg00 ; AND b is not NULL having b <> @arg00 order by a ; a b 1 one 3 three 4 four prepare stmt1 from ' select a,b FROM t1 where a is not NULL AND b is not NULL having b <> ? ' ; AND b is not NULL having b <> ? order by a ' ; execute stmt1 using @arg00 ; a b 1 one Loading Loading @@ -470,7 +470,7 @@ test_sequence ------ join tests ------ select first.a as a1, second.a as a2 from t1 first, t1 second where first.a = second.a ; where first.a = second.a order by a1 ; a1 a2 1 1 2 2 Loading @@ -478,7 +478,7 @@ a1 a2 4 4 prepare stmt1 from ' select first.a as a1, second.a as a2 from t1 first, t1 second where first.a = second.a '; where first.a = second.a order by a1 '; execute stmt1 ; a1 a2 1 1 Loading Loading @@ -517,17 +517,17 @@ a ? a 4 ABC 4 drop table if exists t2 ; create table t2 as select * from t1 ; set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) ' ; set @query2= 'SELECT * FROM t2 natural join t1 ' ; set @query3= 'SELECT * FROM t2 join t1 using(a) ' ; set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) ' ; set @query5= 'SELECT * FROM t2 natural left join t1 ' ; set @query6= 'SELECT * FROM t2 left join t1 using(a) ' ; set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) ' ; set @query8= 'SELECT * FROM t2 natural right join t1 ' ; set @query9= 'SELECT * FROM t2 right join t1 using(a) ' ; set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ; set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ; set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ; set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ; set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ; set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ; set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ; set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ; set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ; the join statement is: SELECT * FROM t2 right join t1 using(a) SELECT * FROM t2 right join t1 using(a) order by t2.a prepare stmt1 from @query9 ; execute stmt1 ; a b a b Loading @@ -548,7 +548,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 natural right join t1 SELECT * FROM t2 natural right join t1 order by t2.a prepare stmt1 from @query8 ; execute stmt1 ; a b a b Loading @@ -569,7 +569,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 right join t1 on(t1.a=t2.a) SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a prepare stmt1 from @query7 ; execute stmt1 ; a b a b Loading @@ -590,7 +590,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 left join t1 using(a) SELECT * FROM t2 left join t1 using(a) order by t2.a prepare stmt1 from @query6 ; execute stmt1 ; a b a b Loading @@ -611,7 +611,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 natural left join t1 SELECT * FROM t2 natural left join t1 order by t2.a prepare stmt1 from @query5 ; execute stmt1 ; a b a b Loading @@ -632,7 +632,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 left join t1 on(t1.a=t2.a) SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a prepare stmt1 from @query4 ; execute stmt1 ; a b a b Loading @@ -653,7 +653,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 join t1 using(a) SELECT * FROM t2 join t1 using(a) order by t2.a prepare stmt1 from @query3 ; execute stmt1 ; a b a b Loading @@ -674,7 +674,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 natural join t1 SELECT * FROM t2 natural join t1 order by t2.a prepare stmt1 from @query2 ; execute stmt1 ; a b Loading @@ -695,7 +695,7 @@ a b 3 three 4 four the join statement is: SELECT * FROM t2 join t1 on (t1.a=t2.a) SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a prepare stmt1 from @query1 ; execute stmt1 ; a b a b Loading Loading @@ -769,7 +769,7 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; a ? b 2 1 two prepare stmt1 from ' select a, b FROM t1 outer_table where a = (select a from t1 where b = outer_table.b ) '; a = (select a from t1 where b = outer_table.b ) order by a '; execute stmt1 ; a b 1 one Loading
mysql-test/r/ps_3innodb.result +31 −31 Original line number Diff line number Diff line Loading @@ -165,26 +165,26 @@ execute stmt1 using @arg00 ; substr('MySQL',1,?) MyS set @arg00='MySQL' ; select a , concat(@arg00,b) from t1 ; select a , concat(@arg00,b) from t1 order by a; a concat(@arg00,b) 1 MySQLone 2 MySQLtwo 3 MySQLthree 4 MySQLfour prepare stmt1 from ' select a , concat(?,b) from t1 ' ; prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ; execute stmt1 using @arg00; a concat(?,b) 1 MySQLone 2 MySQLtwo 3 MySQLthree 4 MySQLfour select a , concat(b,@arg00) from t1 ; select a , concat(b,@arg00) from t1 order by a ; a concat(b,@arg00) 1 oneMySQL 2 twoMySQL 3 threeMySQL 4 fourMySQL prepare stmt1 from ' select a , concat(b,?) from t1 ' ; prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ; execute stmt1 using @arg00; a concat(b,?) 1 oneMySQL Loading Loading @@ -234,14 +234,14 @@ create table t5 (id1 int(11) not null default '0', value2 varchar(100), value1 varchar(100)) ; insert into t5 values (1,'hh','hh'),(2,'hh','hh'), (1,'ii','ii'),(2,'ii','ii') ; prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? ' ; prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ; set @arg00=1 ; set @arg01='hh' ; execute stmt1 using @arg00, @arg01 ; id1 value1 1 hh 2 hh 1 ii 2 hh drop table t5 ; drop table if exists t5 ; create table t5(session_id char(9) not null) ; Loading Loading @@ -307,11 +307,11 @@ execute stmt1 using @arg00 ; a set @arg00=2 ; set @arg01=3 ; select a FROM t1 where a in (@arg00,@arg01); select a FROM t1 where a in (@arg00,@arg01) order by a; a 2 3 prepare stmt1 from ' select a FROM t1 where a in (?,?) '; prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a '; execute stmt1 using @arg00, @arg01; a 2 Loading Loading @@ -385,13 +385,13 @@ a b 4 four set @arg00='two' ; select a,b FROM t1 where a is not NULL AND b is not NULL having b <> @arg00 ; AND b is not NULL having b <> @arg00 order by a ; a b 1 one 3 three 4 four prepare stmt1 from ' select a,b FROM t1 where a is not NULL AND b is not NULL having b <> ? ' ; AND b is not NULL having b <> ? order by a ' ; execute stmt1 using @arg00 ; a b 1 one Loading Loading @@ -470,7 +470,7 @@ test_sequence ------ join tests ------ select first.a as a1, second.a as a2 from t1 first, t1 second where first.a = second.a ; where first.a = second.a order by a1 ; a1 a2 1 1 2 2 Loading @@ -478,7 +478,7 @@ a1 a2 4 4 prepare stmt1 from ' select first.a as a1, second.a as a2 from t1 first, t1 second where first.a = second.a '; where first.a = second.a order by a1 '; execute stmt1 ; a1 a2 1 1 Loading Loading @@ -517,17 +517,17 @@ a ? a 4 ABC 4 drop table if exists t2 ; create table t2 as select * from t1 ; set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) ' ; set @query2= 'SELECT * FROM t2 natural join t1 ' ; set @query3= 'SELECT * FROM t2 join t1 using(a) ' ; set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) ' ; set @query5= 'SELECT * FROM t2 natural left join t1 ' ; set @query6= 'SELECT * FROM t2 left join t1 using(a) ' ; set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) ' ; set @query8= 'SELECT * FROM t2 natural right join t1 ' ; set @query9= 'SELECT * FROM t2 right join t1 using(a) ' ; set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ; set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ; set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ; set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ; set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ; set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ; set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ; set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ; set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ; the join statement is: SELECT * FROM t2 right join t1 using(a) SELECT * FROM t2 right join t1 using(a) order by t2.a prepare stmt1 from @query9 ; execute stmt1 ; a b a b Loading @@ -548,7 +548,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 natural right join t1 SELECT * FROM t2 natural right join t1 order by t2.a prepare stmt1 from @query8 ; execute stmt1 ; a b a b Loading @@ -569,7 +569,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 right join t1 on(t1.a=t2.a) SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a prepare stmt1 from @query7 ; execute stmt1 ; a b a b Loading @@ -590,7 +590,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 left join t1 using(a) SELECT * FROM t2 left join t1 using(a) order by t2.a prepare stmt1 from @query6 ; execute stmt1 ; a b a b Loading @@ -611,7 +611,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 natural left join t1 SELECT * FROM t2 natural left join t1 order by t2.a prepare stmt1 from @query5 ; execute stmt1 ; a b a b Loading @@ -632,7 +632,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 left join t1 on(t1.a=t2.a) SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a prepare stmt1 from @query4 ; execute stmt1 ; a b a b Loading @@ -653,7 +653,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 join t1 using(a) SELECT * FROM t2 join t1 using(a) order by t2.a prepare stmt1 from @query3 ; execute stmt1 ; a b a b Loading @@ -674,7 +674,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 natural join t1 SELECT * FROM t2 natural join t1 order by t2.a prepare stmt1 from @query2 ; execute stmt1 ; a b Loading @@ -695,7 +695,7 @@ a b 3 three 4 four the join statement is: SELECT * FROM t2 join t1 on (t1.a=t2.a) SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a prepare stmt1 from @query1 ; execute stmt1 ; a b a b Loading Loading @@ -769,7 +769,7 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; a ? b 2 1 two prepare stmt1 from ' select a, b FROM t1 outer_table where a = (select a from t1 where b = outer_table.b ) '; a = (select a from t1 where b = outer_table.b ) order by a '; execute stmt1 ; a b 1 one Loading
mysql-test/r/ps_4heap.result +31 −31 Original line number Diff line number Diff line Loading @@ -166,26 +166,26 @@ execute stmt1 using @arg00 ; substr('MySQL',1,?) MyS set @arg00='MySQL' ; select a , concat(@arg00,b) from t1 ; select a , concat(@arg00,b) from t1 order by a; a concat(@arg00,b) 1 MySQLone 2 MySQLtwo 3 MySQLthree 4 MySQLfour prepare stmt1 from ' select a , concat(?,b) from t1 ' ; prepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ; execute stmt1 using @arg00; a concat(?,b) 1 MySQLone 2 MySQLtwo 3 MySQLthree 4 MySQLfour select a , concat(b,@arg00) from t1 ; select a , concat(b,@arg00) from t1 order by a ; a concat(b,@arg00) 1 oneMySQL 2 twoMySQL 3 threeMySQL 4 fourMySQL prepare stmt1 from ' select a , concat(b,?) from t1 ' ; prepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ; execute stmt1 using @arg00; a concat(b,?) 1 oneMySQL Loading Loading @@ -235,14 +235,14 @@ create table t5 (id1 int(11) not null default '0', value2 varchar(100), value1 varchar(100)) ; insert into t5 values (1,'hh','hh'),(2,'hh','hh'), (1,'ii','ii'),(2,'ii','ii') ; prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? ' ; prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ; set @arg00=1 ; set @arg01='hh' ; execute stmt1 using @arg00, @arg01 ; id1 value1 1 hh 2 hh 1 ii 2 hh drop table t5 ; drop table if exists t5 ; create table t5(session_id char(9) not null) ; Loading Loading @@ -308,11 +308,11 @@ execute stmt1 using @arg00 ; a set @arg00=2 ; set @arg01=3 ; select a FROM t1 where a in (@arg00,@arg01); select a FROM t1 where a in (@arg00,@arg01) order by a; a 2 3 prepare stmt1 from ' select a FROM t1 where a in (?,?) '; prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a '; execute stmt1 using @arg00, @arg01; a 2 Loading Loading @@ -386,13 +386,13 @@ a b 4 four set @arg00='two' ; select a,b FROM t1 where a is not NULL AND b is not NULL having b <> @arg00 ; AND b is not NULL having b <> @arg00 order by a ; a b 1 one 3 three 4 four prepare stmt1 from ' select a,b FROM t1 where a is not NULL AND b is not NULL having b <> ? ' ; AND b is not NULL having b <> ? order by a ' ; execute stmt1 using @arg00 ; a b 1 one Loading Loading @@ -471,7 +471,7 @@ test_sequence ------ join tests ------ select first.a as a1, second.a as a2 from t1 first, t1 second where first.a = second.a ; where first.a = second.a order by a1 ; a1 a2 1 1 2 2 Loading @@ -479,7 +479,7 @@ a1 a2 4 4 prepare stmt1 from ' select first.a as a1, second.a as a2 from t1 first, t1 second where first.a = second.a '; where first.a = second.a order by a1 '; execute stmt1 ; a1 a2 1 1 Loading Loading @@ -518,17 +518,17 @@ a ? a 4 ABC 4 drop table if exists t2 ; create table t2 as select * from t1 ; set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) ' ; set @query2= 'SELECT * FROM t2 natural join t1 ' ; set @query3= 'SELECT * FROM t2 join t1 using(a) ' ; set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) ' ; set @query5= 'SELECT * FROM t2 natural left join t1 ' ; set @query6= 'SELECT * FROM t2 left join t1 using(a) ' ; set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) ' ; set @query8= 'SELECT * FROM t2 natural right join t1 ' ; set @query9= 'SELECT * FROM t2 right join t1 using(a) ' ; set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a ' ; set @query2= 'SELECT * FROM t2 natural join t1 order by t2.a ' ; set @query3= 'SELECT * FROM t2 join t1 using(a) order by t2.a ' ; set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a ' ; set @query5= 'SELECT * FROM t2 natural left join t1 order by t2.a ' ; set @query6= 'SELECT * FROM t2 left join t1 using(a) order by t2.a ' ; set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a ' ; set @query8= 'SELECT * FROM t2 natural right join t1 order by t2.a ' ; set @query9= 'SELECT * FROM t2 right join t1 using(a) order by t2.a ' ; the join statement is: SELECT * FROM t2 right join t1 using(a) SELECT * FROM t2 right join t1 using(a) order by t2.a prepare stmt1 from @query9 ; execute stmt1 ; a b a b Loading @@ -549,7 +549,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 natural right join t1 SELECT * FROM t2 natural right join t1 order by t2.a prepare stmt1 from @query8 ; execute stmt1 ; a b a b Loading @@ -570,7 +570,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 right join t1 on(t1.a=t2.a) SELECT * FROM t2 right join t1 on(t1.a=t2.a) order by t2.a prepare stmt1 from @query7 ; execute stmt1 ; a b a b Loading @@ -591,7 +591,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 left join t1 using(a) SELECT * FROM t2 left join t1 using(a) order by t2.a prepare stmt1 from @query6 ; execute stmt1 ; a b a b Loading @@ -612,7 +612,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 natural left join t1 SELECT * FROM t2 natural left join t1 order by t2.a prepare stmt1 from @query5 ; execute stmt1 ; a b a b Loading @@ -633,7 +633,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 left join t1 on(t1.a=t2.a) SELECT * FROM t2 left join t1 on(t1.a=t2.a) order by t2.a prepare stmt1 from @query4 ; execute stmt1 ; a b a b Loading @@ -654,7 +654,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 join t1 using(a) SELECT * FROM t2 join t1 using(a) order by t2.a prepare stmt1 from @query3 ; execute stmt1 ; a b a b Loading @@ -675,7 +675,7 @@ a b a b 3 three 3 three 4 four 4 four the join statement is: SELECT * FROM t2 natural join t1 SELECT * FROM t2 natural join t1 order by t2.a prepare stmt1 from @query2 ; execute stmt1 ; a b Loading @@ -696,7 +696,7 @@ a b 3 three 4 four the join statement is: SELECT * FROM t2 join t1 on (t1.a=t2.a) SELECT * FROM t2 join t1 on (t1.a=t2.a) order by t2.a prepare stmt1 from @query1 ; execute stmt1 ; a b a b Loading Loading @@ -770,7 +770,7 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03 ; a ? b 2 1 two prepare stmt1 from ' select a, b FROM t1 outer_table where a = (select a from t1 where b = outer_table.b ) '; a = (select a from t1 where b = outer_table.b ) order by a '; execute stmt1 ; a b 1 one Loading
mysql-test/r/ps_5merge.result +62 −62 File changed.Preview size limit exceeded, changes collapsed. Show changes