mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fixed bug #18237.
The code in opt_sum_query that prevented the COUNT/MIN/MAX optimization from being applied to outer joins was not adjusted after introducing nested joins. As a result if an outer join contained a reference to a view as an inner table the code of opt_sum_query missed the presence of an on expressions and erroneously applied the mentioned optimization. mysql-test/r/view.result: Added a test case for bug #18237. mysql-test/t/view.test: Added a test case for bug #18237.
This commit is contained in:
@ -2562,3 +2562,20 @@ my_sqrt
|
||||
1.4142135623731
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (id int PRIMARY KEY);
|
||||
CREATE TABLE t2 (id int PRIMARY KEY);
|
||||
INSERT INTO t1 VALUES (1), (3);
|
||||
INSERT INTO t2 VALUES (1), (2), (3);
|
||||
CREATE VIEW v2 AS SELECT * FROM t2;
|
||||
SELECT COUNT(*) FROM t1 LEFT JOIN t2 ON t1.id=t2.id;
|
||||
COUNT(*)
|
||||
2
|
||||
SELECT * FROM t1 LEFT JOIN t2 ON t1.id=t2.id;
|
||||
id id
|
||||
1 1
|
||||
3 3
|
||||
SELECT COUNT(*) FROM t1 LEFT JOIN v2 ON t1.id=v2.id;
|
||||
COUNT(*)
|
||||
2
|
||||
DROP VIEW v2;
|
||||
DROP TABLE t1, t2;
|
||||
|
Reference in New Issue
Block a user