Wrong result with subquery in SELECT clause, and constant table in main query and implicit grouping

Bug #985667 reported by Timour Katchaounov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MariaDB
Fix Released
High
Timour Katchaounov

Bug Description

The following test case, extracted from the test for bug lp:680846 produces wrong result:

CREATE TABLE t1 (f1 int) ;
INSERT INTO t1 VALUES (7),(8);

CREATE TABLE t2 (f2 int, f3 varchar(32)) ;
INSERT INTO t2 VALUES (1,'f');

SELECT COUNT(f2), (SELECT f1 FROM t1 WHERE t2.f2 limit 1) AS f4
FROM t2, t1
WHERE 'v'= t2.f3;

+-----------+------+
| COUNT(f2) | f4 |
+-----------+------+
| 0 | 7 |
+-----------+------+

The correct result is:

+-----------+------+
| COUNT(f2) | f4 |
+-----------+------+
| 0 | NULL |
+-----------+------+

Related branches

Changed in maria:
milestone: none → 5.3
assignee: nobody → Timour Katchaounov (timour)
importance: Undecided → High
status: New → Confirmed
status: Confirmed → In Progress
Changed in maria:
status: In Progress → Fix Released
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.