Loading mysql-test/r/subselect.result +52 −10 Original line number Diff line number Diff line Loading @@ -3718,6 +3718,48 @@ SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1); s1 a DROP TABLE t1; CREATE TABLE t1(f1 int); CREATE TABLE t2(f2 int, f21 int, f3 timestamp); INSERT INTO t1 VALUES (1),(1),(2),(2); INSERT INTO t2 VALUES (1,1,"2004-02-29 11:11:11"), (2,2,"2004-02-29 11:11:11"); SELECT ((SELECT f2 FROM t2 WHERE f21=f1 LIMIT 1) * COUNT(f1)) AS sq FROM t1 GROUP BY f1; sq 2 4 SELECT (SELECT SUM(1) FROM t2 ttt GROUP BY t2.f3 LIMIT 1) AS tt FROM t2; tt 2 2 PREPARE stmt1 FROM 'SELECT ((SELECT f2 FROM t2 WHERE f21=f1 LIMIT 1) * COUNT(f1)) AS sq FROM t1 GROUP BY f1'; EXECUTE stmt1; sq 2 4 EXECUTE stmt1; sq 2 4 DEALLOCATE PREPARE stmt1; SELECT f2, AVG(f21), (SELECT t.f3 FROM t2 AS t WHERE t2.f2=t.f2 AND t.f3=MAX(t2.f3)) AS test FROM t2 GROUP BY f2; f2 AVG(f21) test 1 1.0000 2004-02-29 11:11:11 2 2.0000 2004-02-29 11:11:11 DROP TABLE t1,t2; CREATE TABLE t1 (a int, b INT, c CHAR(10) NOT NULL); 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'); 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 DROP TABLE t1; DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t2; DROP TABLE IF EXISTS t1xt2; Loading sql/sql_yacc.yy +2 −2 Original line number Diff line number Diff line Loading @@ -422,10 +422,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %pure_parser /* We have threads */ /* Currently there is 251 shift/reduce conflict. We should not introduce Currently there is 287 shift/reduce conflict. We should not introduce new conflicts any more. */ %expect 251 %expect 287 /* Comments for TOKENS. Loading Loading
mysql-test/r/subselect.result +52 −10 Original line number Diff line number Diff line Loading @@ -3718,6 +3718,48 @@ SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1); s1 a DROP TABLE t1; CREATE TABLE t1(f1 int); CREATE TABLE t2(f2 int, f21 int, f3 timestamp); INSERT INTO t1 VALUES (1),(1),(2),(2); INSERT INTO t2 VALUES (1,1,"2004-02-29 11:11:11"), (2,2,"2004-02-29 11:11:11"); SELECT ((SELECT f2 FROM t2 WHERE f21=f1 LIMIT 1) * COUNT(f1)) AS sq FROM t1 GROUP BY f1; sq 2 4 SELECT (SELECT SUM(1) FROM t2 ttt GROUP BY t2.f3 LIMIT 1) AS tt FROM t2; tt 2 2 PREPARE stmt1 FROM 'SELECT ((SELECT f2 FROM t2 WHERE f21=f1 LIMIT 1) * COUNT(f1)) AS sq FROM t1 GROUP BY f1'; EXECUTE stmt1; sq 2 4 EXECUTE stmt1; sq 2 4 DEALLOCATE PREPARE stmt1; SELECT f2, AVG(f21), (SELECT t.f3 FROM t2 AS t WHERE t2.f2=t.f2 AND t.f3=MAX(t2.f3)) AS test FROM t2 GROUP BY f2; f2 AVG(f21) test 1 1.0000 2004-02-29 11:11:11 2 2.0000 2004-02-29 11:11:11 DROP TABLE t1,t2; CREATE TABLE t1 (a int, b INT, c CHAR(10) NOT NULL); 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'); 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 DROP TABLE t1; DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t2; DROP TABLE IF EXISTS t1xt2; Loading
sql/sql_yacc.yy +2 −2 Original line number Diff line number Diff line Loading @@ -422,10 +422,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %pure_parser /* We have threads */ /* Currently there is 251 shift/reduce conflict. We should not introduce Currently there is 287 shift/reduce conflict. We should not introduce new conflicts any more. */ %expect 251 %expect 287 /* Comments for TOKENS. Loading