Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:
Description
Reproducible in maria-5.3, maria-5.2. Not reproducible in MySQL 5.5 .
The following query:
SELECT * FROM ( SELECT SUM( DISTINCT f11 ) FROM t1) AS a1;
returns (0) even though the FROM subquery returns (NULL);
Test case:
USE test;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 ( f11 int NOT NULL ) ;
SELECT * FROM ( SELECT SUM( DISTINCT f11 ) FROM t1) AS a1;
explain in maria 5.3:
---------------------------------------------------------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
---------------------------------------------------------------------------------------------+
| 1 | PRIMARY | <derived2> | system | NULL | NULL | NULL | NULL | 1 | |
| 2 | DERIVED | NULL | NULL | NULL | NULL | NULL | NULL | NULL | no matching row in const table |
---------------------------------------------------------------------------------------------+
explain in mysql 5.5:
--------------------------------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
--------------------------------------------------------------------+
| 1 | PRIMARY | <derived2> | system | NULL | NULL | NULL | NULL | 1 | |
| 2 | DERIVED | t1 | ALL | NULL | NULL | NULL | NULL | 1 |
--------------------------------------------------------------------+
Gliffy Diagrams
Attachments
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
Re: Wrong result with Aggregate + DISTINCT in FROM subquery in maria-5.2, 5.2
Also reproducible with MySQL 5.1.56