summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorunknown <sanja@montyprogram.com>2012-05-11 11:40:23 +0300
committerunknown <sanja@montyprogram.com>2012-05-11 11:40:23 +0300
commite10fecc02f57980ddc27bafb9d1f620e8533f4a3 (patch)
tree393865dac63fb0c44cd7c6d166c97a4617b1a313 /mysql-test/t
parentfe0a0bdb143696c54206cd5f908dac94996aab42 (diff)
parentf2cbc014d98a927ed7038f55a25c3d288de10f51 (diff)
downloadmariadb-git-e10fecc02f57980ddc27bafb9d1f620e8533f4a3.tar.gz
Merge 5.2->5.3
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/func_group_innodb.test14
-rw-r--r--mysql-test/t/group_by.test75
-rw-r--r--mysql-test/t/join_outer.test19
-rw-r--r--mysql-test/t/log_state.test14
4 files changed, 113 insertions, 9 deletions
diff --git a/mysql-test/t/func_group_innodb.test b/mysql-test/t/func_group_innodb.test
index 1bdfd8f54bb..9e88894de58 100644
--- a/mysql-test/t/func_group_innodb.test
+++ b/mysql-test/t/func_group_innodb.test
@@ -83,3 +83,17 @@ explain select count(*), min(7), max(7) from t2m, t1i;
select count(*), min(7), max(7) from t2m, t1i;
drop table t1m, t1i, t2m, t2i;
+
+
+--echo #
+--echo # Bug#13723054 CRASH WITH MIN/MAX AFTER QUICK_GROUP_MIN_MAX_SELECT::NEXT_MIN
+--echo #
+
+CREATE TABLE t1(a BLOB, b VARCHAR(255) CHARSET LATIN1, c INT,
+ KEY(b, c, a(765))) ENGINE=INNODB;
+INSERT INTO t1(a, b, c) VALUES ('', 'a', 0), ('', 'a', null), ('', 'a', 0);
+
+SELECT MIN(c) FROM t1 GROUP BY b;
+EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b;
+
+DROP TABLE t1;
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index f9e8e671063..d4214442709 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -1377,10 +1377,82 @@ t2_1.b + 1 > 0 OR
a = t2_1.c
GROUP BY zzz;
---echo #TODO: in merge with 5.3 add original test suite
+SET @save_optimizer_switch967242=@@optimizer_switch;
+SET optimizer_switch = 'in_to_exists=on';
+
+SELECT t2_1.b
+FROM t1 JOIN t2 AS t2_1 JOIN t2 AS t2_2
+ ON (t2_2.b = t2_1.b ) AND (t2_2.c = t2_1.c )
+WHERE
+ ( SELECT COUNT(*) FROM t2 ) IS NOT NULL
+ OR a = t2_1.c
+GROUP BY t2_1.b;
+SET optimizer_switch=@save_optimizer_switch967242;
drop table t1, t2;
+--echo #
+--echo # Bug#12578908: SELECT SQL_BUFFER_RESULT OUTPUTS TOO MANY
+--echo # ROWS WHEN GROUP IS OPTIMIZED AWAY
+--echo #
+
+CREATE TABLE t1 (col1 int, col2 int) ;
+INSERT INTO t1 VALUES (10,1),(11,7);
+
+CREATE TABLE t2 (col1 int, col2 int) ;
+INSERT INTO t2 VALUES (10,8);
+
+let $q_body=t2.col2 FROM t2 JOIN t1 ON t1.col1 GROUP BY t2.col2;
+
+--echo
+--eval EXPLAIN SELECT SQL_BUFFER_RESULT $q_body
+--eval SELECT SQL_BUFFER_RESULT $q_body
+--echo
+--eval EXPLAIN SELECT $q_body
+--eval SELECT $q_body
+
+--echo
+DROP TABLE t1,t2;
+
+--echo #
+--echo # BUG#12640437: USING SQL_BUFFER_RESULT RESULTS IN A
+--echo # DIFFERENT QUERY OUTPUT
+--echo #
+
+CREATE TABLE t1 (
+ a int,
+ b varchar(1),
+ KEY (b,a)
+);
+
+INSERT INTO t1 VALUES (1,NULL),(0,'a');
+
+let $query=
+ SELECT SQL_BUFFER_RESULT MIN(a), b FROM t1 WHERE t1.b = 'a' GROUP BY b;
+
+--echo
+--eval EXPLAIN $query
+--echo
+--eval $query
+
+let $query= SELECT MIN(a), b FROM t1 WHERE t1.b = 'a' GROUP BY b;
+--echo
+--eval EXPLAIN $query
+--echo
+--eval $query
+
+--echo
+DROP TABLE t1;
+
+--echo #
+--echo # LP bug#993726 Wrong result from a query with ALL subquery predicate in WHERE
+--echo #
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (0);
+SELECT 1 FROM t1 WHERE 1 > ALL(SELECT 1 FROM t1 WHERE a!=0);
+SELECT max(1) FROM t1 WHERE a!=0;
+drop table t1;
+
--echo # End of 5.2 tests
--echo #
@@ -1401,4 +1473,3 @@ GROUP BY 1;
DROP TABLE t1, t2;
--echo # End of 5.3 tests
-
diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test
index 3b2ab662dd8..69c08cd54bd 100644
--- a/mysql-test/t/join_outer.test
+++ b/mysql-test/t/join_outer.test
@@ -1179,6 +1179,25 @@ DROP TABLE t1;
--echo End of 5.1 tests
--echo #
+--echo # LP BUG#994392: Wrong result with RIGHT/LEFT JOIN and ALL subquery
+--echo # predicate in WHERE condition.
+--echo #
+
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES(9);
+CREATE TABLE t2(b INT);
+INSERT INTO t2 VALUES(8);
+CREATE TABLE t3(c INT);
+INSERT INTO t3 VALUES(3);
+SELECT * FROM t2 RIGHT JOIN t3 ON(c = b) WHERE b < ALL(SELECT a FROM t1 WHERE a <= 7);
+SELECT * FROM t3 LEFT JOIN t2 ON(c = b) WHERE b < ALL(SELECT a FROM t1 WHERE a <= 7);
+SELECT * FROM t2 RIGHT JOIN t3 ON(c = b) WHERE b not in (SELECT a FROM t1 WHERE a <= 7);
+SELECT * FROM t3 LEFT JOIN t2 ON(c = b) WHERE b not in (SELECT a FROM t1 WHERE a <= 7);
+drop table t1,t2,t3;
+
+--echo End of 5.2 tests
+
+--echo #
--echo # LP bug #813447: LEFT JOIN with single-row inner table and
--echo # a subquery in ON expression
--echo #
diff --git a/mysql-test/t/log_state.test b/mysql-test/t/log_state.test
index 05e17dc9fa7..032c46e83b6 100644
--- a/mysql-test/t/log_state.test
+++ b/mysql-test/t/log_state.test
@@ -381,13 +381,13 @@ CREATE TABLE t2 (b INT, PRIMARY KEY (b));
INSERT INTO t2 VALUES (3),(4);
connect (con2,localhost,root,,);
-INSERT INTO t1 VALUES (1+sleep(.01)),(2);
-INSERT INTO t1 SELECT b+sleep(.01) from t2;
-UPDATE t1 SET a=a+sleep(.01) WHERE a>2;
-UPDATE t1 SET a=a+sleep(.01) ORDER BY a DESC;
-UPDATE t2 set b=b+sleep(.01) limit 1;
-UPDATE t1 SET a=a+sleep(.01) WHERE a in (SELECT b from t2);
-DELETE FROM t1 WHERE a=a+sleep(.01) ORDER BY a LIMIT 2;
+INSERT INTO t1 VALUES (1+sleep(.02)),(2);
+INSERT INTO t1 SELECT b+sleep(.02) from t2;
+UPDATE t1 SET a=a+sleep(.02) WHERE a>2;
+UPDATE t1 SET a=a+sleep(.02) ORDER BY a DESC;
+UPDATE t2 set b=b+sleep(.02) limit 1;
+UPDATE t1 SET a=a+sleep(.02) WHERE a in (SELECT b from t2);
+DELETE FROM t1 WHERE a=a+sleep(.02) ORDER BY a LIMIT 2;
SELECT rows_examined,sql_text FROM mysql.slow_log;
disconnect con2;