summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2010-11-09 19:40:02 -0800
committerIgor Babaev <igor@askmonty.org>2010-11-09 19:40:02 -0800
commit6e5bcca7935d3c62f84bb640e5357664a210ee12 (patch)
treed8559bd522bde648c26a1ca380d19e13e1aa6ad8 /mysql-test
parent05f21b21e4942efe02fa6dd334094cc64ce0983b (diff)
parent6b67bafc747e10815566178d730b190a84803fb7 (diff)
downloadmariadb-git-6e5bcca7935d3c62f84bb640e5357664a210ee12.tar.gz
Merge
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/suite/innodb/r/innodb_mysql.result38
-rw-r--r--mysql-test/suite/innodb/t/innodb_mysql.test36
2 files changed, 72 insertions, 2 deletions
diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result
index e6383fb97fa..4e7ca8b4d8f 100644
--- a/mysql-test/suite/innodb/r/innodb_mysql.result
+++ b/mysql-test/suite/innodb/r/innodb_mysql.result
@@ -2609,5 +2609,41 @@ ref NULL
rows 3
Extra Using index
DROP TABLE t1;
-#
End of 5.1 tests
+#
+# Bug#668644: HAVING + ORDER BY
+#
+CREATE TABLE t1 (
+pk int NOT NULL PRIMARY KEY, i int DEFAULT NULL,
+INDEX idx (i)
+) ENGINE=INNODB;
+INSERT INTO t1 VALUES
+(6,-1636630528),(2,-1097924608),(1,6),(3,6),(4,1148715008),(5,1541734400);
+CREATE TABLE t2 (
+i int DEFAULT NULL,
+pk int NOT NULL PRIMARY KEY,
+INDEX idx (i)
+) ENGINE= INNODB;
+INSERT INTO t2 VALUES
+(-1993998336,20),(-1036582912,1),(-733413376,5),(-538247168,16),
+(-514260992,4),(-249561088,9),(1,2),(1,6),(2,10),(2,19),(4,17),
+(5,14),(5,15),(6,8),(7,13),(8,18),(9,11),(9,12),(257425408,7),
+(576061440,3);
+EXPLAIN
+SELECT t1 .i AS f FROM t1, t2
+WHERE t2.i = t1.pk AND t1.pk BETWEEN 0 AND 224
+HAVING f > 7
+ORDER BY f;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using filesort
+1 SIMPLE t2 ref idx idx 5 test.t1.pk 1 Using index
+SELECT t1 .i AS f FROM t1, t2
+WHERE t2.i = t1.pk AND t1.pk BETWEEN 0 AND 224
+HAVING f > 7
+ORDER BY f;
+f
+1148715008
+1541734400
+1541734400
+DROP TABLE t1, t2;
+End of 5.3 tests
diff --git a/mysql-test/suite/innodb/t/innodb_mysql.test b/mysql-test/suite/innodb/t/innodb_mysql.test
index e346d91aaa4..6f278dae538 100644
--- a/mysql-test/suite/innodb/t/innodb_mysql.test
+++ b/mysql-test/suite/innodb/t/innodb_mysql.test
@@ -840,7 +840,41 @@ CREATE INDEX b ON t1(a,b,c,d);
DROP TABLE t1;
+--echo End of 5.1 tests
+
+--echo #
+--echo # Bug#668644: HAVING + ORDER BY
--echo #
+CREATE TABLE t1 (
+ pk int NOT NULL PRIMARY KEY, i int DEFAULT NULL,
+ INDEX idx (i)
+) ENGINE=INNODB;
+INSERT INTO t1 VALUES
+ (6,-1636630528),(2,-1097924608),(1,6),(3,6),(4,1148715008),(5,1541734400);
---echo End of 5.1 tests
+CREATE TABLE t2 (
+ i int DEFAULT NULL,
+ pk int NOT NULL PRIMARY KEY,
+ INDEX idx (i)
+) ENGINE= INNODB;
+INSERT INTO t2 VALUES
+ (-1993998336,20),(-1036582912,1),(-733413376,5),(-538247168,16),
+ (-514260992,4),(-249561088,9),(1,2),(1,6),(2,10),(2,19),(4,17),
+ (5,14),(5,15),(6,8),(7,13),(8,18),(9,11),(9,12),(257425408,7),
+ (576061440,3);
+
+EXPLAIN
+SELECT t1 .i AS f FROM t1, t2
+ WHERE t2.i = t1.pk AND t1.pk BETWEEN 0 AND 224
+ HAVING f > 7
+ ORDER BY f;
+SELECT t1 .i AS f FROM t1, t2
+ WHERE t2.i = t1.pk AND t1.pk BETWEEN 0 AND 224
+ HAVING f > 7
+ ORDER BY f;
+
+DROP TABLE t1, t2;
+
+
+--echo End of 5.3 tests