Wrong result with empty table, HAVING, implicit grouping and non-aggregated column in select

Bug #1002326 reported by Timour Katchaounov
6
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.

Revision history for this message
Timour Katchaounov (timour) wrote :

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.

Changed in maria:
milestone: none → 5.3
assignee: nobody → Timour Katchaounov (timour)
status: New → Confirmed
importance: Undecided → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.