Wrong result with empty table, HAVING, implicit grouping and non-aggregated column in select
Bug #1002326 reported by
Timour Katchaounov
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Confirmed
|
Low
|
Timour Katchaounov |
Bug Description
The following test case produces wrong result:
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (7),(0);
CREATE TABLE t2 (b INT);
SELECT SUM(a), a FROM (t1, t2) WHERE t1.a >= 4;
+--------+------+
| SUM(a) | a |
+--------+------+
| NULL | NULL |
+--------+------+
1 row in set (0.00 sec)
SELECT SUM(a), a FROM t1, t2 WHERE t1.a >= 4;
+--------+------+
| SUM(a) | a |
+--------+------+
| 7 | 7 |
+--------+------+
The only difference between the queries are the braces in the FROM clause.
This test case was extracted from bug lp:1002079.
To post a comment you must log in.
The bug is present only in MariaDB 5.5 (not 5.2, and 5.5), and requires a non-aggregated column (which is a MySQL extension).
Thus I consider it low priority.