Commit e5627c98 authored by Igor Babaev's avatar Igor Babaev

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.
parent c118219f
...@@ -552,6 +552,28 @@ WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR ...@@ -552,6 +552,28 @@ WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR
DROP TABLE t1, t2; 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 #
--echo # BUG#778434 Wrong result with in_to_exists=on in maria-5.3-mwl89 --echo # BUG#778434 Wrong result with in_to_exists=on in maria-5.3-mwl89
--echo # --echo #
......
...@@ -514,6 +514,30 @@ WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR ...@@ -514,6 +514,30 @@ WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR
c2 c2
DROP TABLE t1, t2; 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 # BUG#778434 Wrong result with in_to_exists=on in maria-5.3-mwl89
# #
CREATE TABLE t1 ( f11 int) ; CREATE TABLE t1 ( f11 int) ;
......
...@@ -520,6 +520,30 @@ WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR ...@@ -520,6 +520,30 @@ WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR
c2 c2
DROP TABLE t1, t2; 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 # BUG#778434 Wrong result with in_to_exists=on in maria-5.3-mwl89
# #
CREATE TABLE t1 ( f11 int) ; CREATE TABLE t1 ( f11 int) ;
......
...@@ -518,6 +518,30 @@ WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR ...@@ -518,6 +518,30 @@ WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR
c2 c2
DROP TABLE t1, t2; 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 # BUG#778434 Wrong result with in_to_exists=on in maria-5.3-mwl89
# #
CREATE TABLE t1 ( f11 int) ; CREATE TABLE t1 ( f11 int) ;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment