mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fixed LP bug #702322.
The bug was a result of the fix for bug 668644 that turned out to be not quite correct. A problem appeared with HAVING conditions containing more than one predicate. If a query with an ORDER BY clause uses such HAVING condition and the required order can be obtained with a range/index scan then the HAVING condition has to be pushed into two different formulas (items). To be able to do it we have to create a copy of the ANDOR structure of the pushed condition.
This commit is contained in:
@ -938,4 +938,26 @@ SELECT t1 .i AS f FROM t1, t2
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#702322: HAVING with two ANDed predicates + ORDER BY
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (pk int PRIMARY KEY, a int, KEY (a)) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (a int, KEY (a)) ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO t1 VALUES
|
||||
(18,0),(9,10),(8,11),(2,15),(7,19),(1,20);
|
||||
|
||||
SET SESSION join_cache_level = 0;
|
||||
|
||||
EXPLAIN
|
||||
SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.pk = t2.a
|
||||
WHERE t1.pk >= 6 HAVING t1.a<> 0 AND t1.a <> 11
|
||||
ORDER BY t1.a;
|
||||
SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.pk = t2.a
|
||||
WHERE t1.pk >= 6 HAVING t1.a<> 0 AND t1.a <> 11
|
||||
ORDER BY t1.a;
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
--echo End of 5.3 tests
|
||||
|
Reference in New Issue
Block a user