sql_buffer_result=1 gives wrong result for GROUP BY with a constant expression
Bug #780425 reported by
Michael Widenius
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Fix Released
|
Medium
|
Michael Widenius |
Bug Description
This fails in MySQL 5.1, MariaDB 5.1 and above:
drop table if exists t1;
CREATE TABLE t1(f1 DECIMAL(5,1) UNSIGNED);
INSERT INTO t1 VALUES (0.2),(0.1);
set sql_buffer_
SELECT 1 as 'one' FROM t1 GROUP BY @a:= (SELECT ROUND(f1) FROM t1 WHERE f1 = 0);
set sql_buffer_
SELECT 1 as 'one' FROM t1 GROUP BY @a:= (SELECT ROUND(f1) FROM t1 WHERE f1 = 0);
The second query return two rows, the first one only one row (which is correct).
Changed in maria: | |
assignee: | nobody → Oleksandr "Sanja" Byelkin (sanja-byelkin) |
importance: | Undecided → Medium |
milestone: | none → 5.1 |
Changed in maria: | |
status: | New → In Progress |
Changed in maria: | |
assignee: | Oleksandr "Sanja" Byelkin (sanja-byelkin) → Michael Widenius (monty) |
To post a comment you must log in.
A bit simplified test suite:
CREATE TABLE t1(f1 int UNSIGNED); result= 0; result= 1;
INSERT INTO t1 VALUES (2),(1);
set sql_buffer_
SELECT 1 as 'one' FROM t1 GROUP BY (SELECT f1 FROM t1 WHERE f1 = 0);
set sql_buffer_
SELECT 1 as 'one' FROM t1 GROUP BY (SELECT f1 FROM t1 WHERE f1 = 0);
drop table t1;