Bug #10982 A query from olap.test returns a wrong result set
Submitted: 31 May 2005 12:02 Modified: 1 Jun 2005 3:49
Reporter: Igor Babaev Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0 OS:Any (all)
Assigned to: Igor Babaev CPU Architecture:Any

[31 May 2005 12:02] Igor Babaev
Description:
The following query from olap.test
SELECT a+SUM(a) FROM t1 GROUP BY a WITH ROLLUP;
returns a wrong result set:
mysql> SELECT a+SUM(a) FROM t1 GROUP BY a WITH ROLLUP;
+----------+
| a+SUM(a) |
+----------+
| 3        |
| 4        |
| NULL     |
+----------+

Must be:

mysql> SELECT a+SUM(a) FROM t1 GROUP BY a WITH ROLLUP;
+----------+
| a+SUM(a) |
+----------+
| 2        |
| 4        |
| NULL     |
+----------+

 

How to repeat:
CREATE TABLE t1 (a int(11));
INSERT INTO t1 VALUES (1),(2);
SELECT a+SUM(a) FROM t1 GROUP BY a WITH ROLLUP;
[31 May 2005 12:06] Igor Babaev
Bear in mind that the result set for the reported query in 4.1 is correct.
[31 May 2005 14:59] Igor Babaev
ChangeSet
  1.1937 05/05/31 05:56:22 igor@rurik.mysql.com +2 -0
  olap.result:
    Fixed bug #10982.
  item.cc:
    Fixed bug #10982. In the function Item_ref::val_decimal
    by mistake the method Item_ref::val_decimal was used
    instead of Item_ref::val_decimal_result.

The fix will appear in 5.0.7
[1 Jun 2005 3:49] Paul DuBois
Noted in 5.0.7 changelog.
[2 Jun 2005 11:20] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/25508