Loading mysql-test/r/func_in.result +5 −0 Original line number Diff line number Diff line Loading @@ -470,4 +470,9 @@ a Warnings: Warning 1292 Incorrect date value: '19772-07-29' for column 'a' at row 1 DROP TABLE t1,t2,t3,t4; CREATE TABLE t1 (id int not null); INSERT INTO t1 VALUES (1),(2); SELECT id FROM t1 WHERE id IN(4564, (SELECT IF(1=0,1,1/0)) ); id DROP TABLE t1; End of 5.0 tests mysql-test/r/subselect.result +25 −0 Original line number Diff line number Diff line Loading @@ -3880,3 +3880,28 @@ this is a test. 3 this is a test. 1 this is a test. 2 DROP table t1; CREATE TABLE t1 (a int, b int); CREATE TABLE t2 (m int, n int); INSERT INTO t1 VALUES (2,2), (2,2), (3,3), (3,3), (3,3), (4,4); INSERT INTO t2 VALUES (1,11), (2,22), (3,32), (4,44), (4,44); SELECT COUNT(*), a, (SELECT m FROM t2 WHERE m = count(*) LIMIT 1) FROM t1 GROUP BY a; COUNT(*) a (SELECT m FROM t2 WHERE m = count(*) LIMIT 1) 2 2 2 3 3 3 1 4 1 SELECT COUNT(*), a, (SELECT MIN(m) FROM t2 WHERE m = count(*)) FROM t1 GROUP BY a; COUNT(*) a (SELECT MIN(m) FROM t2 WHERE m = count(*)) 2 2 2 3 3 3 1 4 1 SELECT COUNT(*), a FROM t1 GROUP BY a HAVING (SELECT MIN(m) FROM t2 WHERE m = count(*)) > 1; COUNT(*) a 2 2 3 3 DROP TABLE t1,t2; mysql-test/r/subselect3.result +53 −0 Original line number Diff line number Diff line Loading @@ -645,3 +645,56 @@ a b Z 2 2 0 3 3 1 drop table t1,t2; CREATE TABLE t1 (a int, b INT, c CHAR(10) NOT NULL, PRIMARY KEY (a, b)); INSERT INTO t1 VALUES (1,1,'a'), (1,2,'b'), (1,3,'c'), (1,4,'d'), (1,5,'e'), (2,1,'f'), (2,2,'g'), (2,3,'h'), (3,4,'i'),(3,3,'j'), (3,2,'k'), (3,1,'l'), (1,9,'m'); CREATE TABLE t2 (a int, b INT, c CHAR(10) NOT NULL, PRIMARY KEY (a, b)); INSERT INTO t2 SELECT * FROM t1; SELECT a, MAX(b), (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b)) as test FROM t1 GROUP BY a; a MAX(b) test 1 9 m 2 3 h 3 4 i SELECT * FROM t1 GROUP by t1.a HAVING (MAX(t1.b) > (SELECT MAX(t2.b) FROM t2 WHERE t2.c < t1.c HAVING MAX(t2.b+t1.a) < 10)); a b c SELECT a, AVG(b), (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=AVG(t1.b)) AS test FROM t1 GROUP BY a; a AVG(b) test 1 4.0000 NULL 2 2.0000 k 3 2.5000 NULL SELECT a,b,c FROM t1 WHERE b in (9,3,4) ORDER BY b,c; a b c 1 3 c 2 3 h 3 3 j 1 4 d 3 4 i 1 9 m SELECT a, MAX(b), (SELECT COUNT(DISTINCT t.c) FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b) LIMIT 1) as cnt, (SELECT t.b FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b) LIMIT 1) as t_b, (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b) LIMIT 1) as t_b, (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b) ORDER BY t.c LIMIT 1) as t_b FROM t1 GROUP BY a; a MAX(b) cnt t_b t_b t_b 1 9 1 9 m m 2 3 1 3 h h 3 4 1 4 i i SELECT a, MAX(b), (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b) LIMIT 1) as test FROM t1 GROUP BY a; a MAX(b) test 1 9 m 2 3 h 3 4 i DROP TABLE t1, t2; mysql-test/r/union.result +8 −0 Original line number Diff line number Diff line Loading @@ -1381,4 +1381,12 @@ a SELECT a FROM (SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY c) AS test; ERROR 42S22: Unknown column 'c' in 'order clause' DROP TABLE t1; (select 1 into @var) union (select 1); ERROR HY000: Incorrect usage of UNION and INTO (select 1) union (select 1 into @var); select @var; @var 1 (select 2) union (select 1 into @var); ERROR 42000: Result consisted of more than one row End of 5.0 tests mysql-test/t/func_in.test +11 −0 Original line number Diff line number Diff line Loading @@ -360,4 +360,15 @@ SELECT * FROM t4 WHERE a IN ('1972-02-06','19772-07-29'); DROP TABLE t1,t2,t3,t4; # # BUG#27362: IN with a decimal expression that may return NULL # CREATE TABLE t1 (id int not null); INSERT INTO t1 VALUES (1),(2); SELECT id FROM t1 WHERE id IN(4564, (SELECT IF(1=0,1,1/0)) ); DROP TABLE t1; --echo End of 5.0 tests Loading
mysql-test/r/func_in.result +5 −0 Original line number Diff line number Diff line Loading @@ -470,4 +470,9 @@ a Warnings: Warning 1292 Incorrect date value: '19772-07-29' for column 'a' at row 1 DROP TABLE t1,t2,t3,t4; CREATE TABLE t1 (id int not null); INSERT INTO t1 VALUES (1),(2); SELECT id FROM t1 WHERE id IN(4564, (SELECT IF(1=0,1,1/0)) ); id DROP TABLE t1; End of 5.0 tests
mysql-test/r/subselect.result +25 −0 Original line number Diff line number Diff line Loading @@ -3880,3 +3880,28 @@ this is a test. 3 this is a test. 1 this is a test. 2 DROP table t1; CREATE TABLE t1 (a int, b int); CREATE TABLE t2 (m int, n int); INSERT INTO t1 VALUES (2,2), (2,2), (3,3), (3,3), (3,3), (4,4); INSERT INTO t2 VALUES (1,11), (2,22), (3,32), (4,44), (4,44); SELECT COUNT(*), a, (SELECT m FROM t2 WHERE m = count(*) LIMIT 1) FROM t1 GROUP BY a; COUNT(*) a (SELECT m FROM t2 WHERE m = count(*) LIMIT 1) 2 2 2 3 3 3 1 4 1 SELECT COUNT(*), a, (SELECT MIN(m) FROM t2 WHERE m = count(*)) FROM t1 GROUP BY a; COUNT(*) a (SELECT MIN(m) FROM t2 WHERE m = count(*)) 2 2 2 3 3 3 1 4 1 SELECT COUNT(*), a FROM t1 GROUP BY a HAVING (SELECT MIN(m) FROM t2 WHERE m = count(*)) > 1; COUNT(*) a 2 2 3 3 DROP TABLE t1,t2;
mysql-test/r/subselect3.result +53 −0 Original line number Diff line number Diff line Loading @@ -645,3 +645,56 @@ a b Z 2 2 0 3 3 1 drop table t1,t2; CREATE TABLE t1 (a int, b INT, c CHAR(10) NOT NULL, PRIMARY KEY (a, b)); INSERT INTO t1 VALUES (1,1,'a'), (1,2,'b'), (1,3,'c'), (1,4,'d'), (1,5,'e'), (2,1,'f'), (2,2,'g'), (2,3,'h'), (3,4,'i'),(3,3,'j'), (3,2,'k'), (3,1,'l'), (1,9,'m'); CREATE TABLE t2 (a int, b INT, c CHAR(10) NOT NULL, PRIMARY KEY (a, b)); INSERT INTO t2 SELECT * FROM t1; SELECT a, MAX(b), (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b)) as test FROM t1 GROUP BY a; a MAX(b) test 1 9 m 2 3 h 3 4 i SELECT * FROM t1 GROUP by t1.a HAVING (MAX(t1.b) > (SELECT MAX(t2.b) FROM t2 WHERE t2.c < t1.c HAVING MAX(t2.b+t1.a) < 10)); a b c SELECT a, AVG(b), (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=AVG(t1.b)) AS test FROM t1 GROUP BY a; a AVG(b) test 1 4.0000 NULL 2 2.0000 k 3 2.5000 NULL SELECT a,b,c FROM t1 WHERE b in (9,3,4) ORDER BY b,c; a b c 1 3 c 2 3 h 3 3 j 1 4 d 3 4 i 1 9 m SELECT a, MAX(b), (SELECT COUNT(DISTINCT t.c) FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b) LIMIT 1) as cnt, (SELECT t.b FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b) LIMIT 1) as t_b, (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b) LIMIT 1) as t_b, (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b) ORDER BY t.c LIMIT 1) as t_b FROM t1 GROUP BY a; a MAX(b) cnt t_b t_b t_b 1 9 1 9 m m 2 3 1 3 h h 3 4 1 4 i i SELECT a, MAX(b), (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b) LIMIT 1) as test FROM t1 GROUP BY a; a MAX(b) test 1 9 m 2 3 h 3 4 i DROP TABLE t1, t2;
mysql-test/r/union.result +8 −0 Original line number Diff line number Diff line Loading @@ -1381,4 +1381,12 @@ a SELECT a FROM (SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY c) AS test; ERROR 42S22: Unknown column 'c' in 'order clause' DROP TABLE t1; (select 1 into @var) union (select 1); ERROR HY000: Incorrect usage of UNION and INTO (select 1) union (select 1 into @var); select @var; @var 1 (select 2) union (select 1 into @var); ERROR 42000: Result consisted of more than one row End of 5.0 tests
mysql-test/t/func_in.test +11 −0 Original line number Diff line number Diff line Loading @@ -360,4 +360,15 @@ SELECT * FROM t4 WHERE a IN ('1972-02-06','19772-07-29'); DROP TABLE t1,t2,t3,t4; # # BUG#27362: IN with a decimal expression that may return NULL # CREATE TABLE t1 (id int not null); INSERT INTO t1 VALUES (1),(2); SELECT id FROM t1 WHERE id IN(4564, (SELECT IF(1=0,1,1/0)) ); DROP TABLE t1; --echo End of 5.0 tests