HAVING does not reject the result of aggregation
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Fix Released
|
High
|
Oleksandr "Sanja" Byelkin |
Bug Description
Using mariadb-5.2 create and populate table 1 with the following commands:
CREATE TABLE t1 (pk INT PRIMARY KEY, a INT);
INSERT INTO t1 VALUES (2,7), (4,7), (6,2), (17,0);
Execute the following queries:
SELECT MIN(t.pk) FROM t1, t1 as t WHERE t1.pk = 1;
SELECT MIN(t.pk) FROM t1, t1 as t WHERE t1.pk = 1 HAVING MIN(t.pk) < 10;
The first query return the right result while the second query returns a wrong result:
MariaDB [test]> SELECT MIN(t.pk) FROM t1, t1 as t WHERE t1.pk = 1;
+-----------+
| MIN(t.pk) |
+-----------+
| NULL |
+-----------+
MariaDB [test]> SELECT MIN(t.pk) FROM t1, t1 as t WHERE t1.pk = 1 HAVING MIN(t.pk) < 10;
+-----------+
| MIN(t.pk) |
+-----------+
| NULL |
+-----------+
Changed in maria: | |
status: | New → Confirmed |
assignee: | nobody → Oleksandr "Sanja" Byelkin (sanja-byelkin) |
importance: | Undecided → High |
milestone: | none → 5.2 |
Changed in maria: | |
status: | Confirmed → In Progress |
Changed in maria: | |
status: | In Progress → Fix Released |