Backported the test case for bug 58838 from mysql-5.6 code line.

The bug was fixed by the patches for LP bugs 668644,702322 that
were applied earlier to the mariadb-5.3 code.
This commit is contained in:
Igor Babaev 2011-10-30 04:18:09 -07:00
parent c118219f38
commit e5627c9802
4 changed files with 94 additions and 0 deletions

View file

@ -552,6 +552,28 @@ WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR
DROP TABLE t1, t2;
--echo #
--echo # Bug#58838: "Wrong results with HAVING + LIMIT without GROUP BY when
--echo # ICP is enabled".
--echo # (Fixed by the patches for LP bugs #668644, #702322)
--echo #
CREATE TABLE t1 (
pk INT NOT NULL,
c1 INT,
PRIMARY KEY (pk),
KEY col_int_key (c1)
);
INSERT INTO t1 VALUES (1,37),(2,8),(3,-25),(4,NULL),(5,55);
SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 0;
SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 1;
SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 2;
SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 5;
DROP TABLE t1;
--echo #
--echo # BUG#778434 Wrong result with in_to_exists=on in maria-5.3-mwl89
--echo #

View file

@ -514,6 +514,30 @@ WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR
c2
DROP TABLE t1, t2;
#
# Bug#58838: "Wrong results with HAVING + LIMIT without GROUP BY when
# ICP is enabled".
# (Fixed by the patches for LP bugs #668644, #702322)
#
CREATE TABLE t1 (
pk INT NOT NULL,
c1 INT,
PRIMARY KEY (pk),
KEY col_int_key (c1)
);
INSERT INTO t1 VALUES (1,37),(2,8),(3,-25),(4,NULL),(5,55);
SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 0;
pk
SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 1;
pk
3
SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 2;
pk
3
SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 5;
pk
3
DROP TABLE t1;
#
# BUG#778434 Wrong result with in_to_exists=on in maria-5.3-mwl89
#
CREATE TABLE t1 ( f11 int) ;

View file

@ -520,6 +520,30 @@ WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR
c2
DROP TABLE t1, t2;
#
# Bug#58838: "Wrong results with HAVING + LIMIT without GROUP BY when
# ICP is enabled".
# (Fixed by the patches for LP bugs #668644, #702322)
#
CREATE TABLE t1 (
pk INT NOT NULL,
c1 INT,
PRIMARY KEY (pk),
KEY col_int_key (c1)
);
INSERT INTO t1 VALUES (1,37),(2,8),(3,-25),(4,NULL),(5,55);
SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 0;
pk
SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 1;
pk
3
SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 2;
pk
3
SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 5;
pk
3
DROP TABLE t1;
#
# BUG#778434 Wrong result with in_to_exists=on in maria-5.3-mwl89
#
CREATE TABLE t1 ( f11 int) ;

View file

@ -518,6 +518,30 @@ WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR
c2
DROP TABLE t1, t2;
#
# Bug#58838: "Wrong results with HAVING + LIMIT without GROUP BY when
# ICP is enabled".
# (Fixed by the patches for LP bugs #668644, #702322)
#
CREATE TABLE t1 (
pk INT NOT NULL,
c1 INT,
PRIMARY KEY (pk),
KEY col_int_key (c1)
);
INSERT INTO t1 VALUES (1,37),(2,8),(3,-25),(4,NULL),(5,55);
SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 0;
pk
SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 1;
pk
3
SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 2;
pk
3
SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 5;
pk
3
DROP TABLE t1;
#
# BUG#778434 Wrong result with in_to_exists=on in maria-5.3-mwl89
#
CREATE TABLE t1 ( f11 int) ;