1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Fixed bug mdev-4063 (bug #56927).

This bug could result in returning 0 for the expressions of the form 
<aggregate_function>(distinct field) when the system variable  
max_heap_table_size was set to a small enough number.
It happened because the method Unique::walk() did not support
the case when more than one pass was needed to merge the trees
of distinct values saved in an external file.

Backported a fix in grant_lowercase.test from mariadb 5.5.
This commit is contained in:
Igor Babaev
2013-01-21 11:47:45 -08:00
parent 2e11ca36f2
commit fade3647ec
6 changed files with 146 additions and 69 deletions

View File

@ -103,5 +103,20 @@ sm
10323810
10325070
10326330
#
# Bug mdev-4063: SUM(DISTINCT...) with small'max_heap_table_size
# (bug #56927)
#
SET max_heap_table_size=default;
INSERT INTO t1 SELECT id+16384 FROM t1;
DELETE FROM t2;
INSERT INTO t2 SELECT id FROM t1 ORDER BY id*rand();
SELECT SUM(DISTINCT id) sm FROM t2;
sm
536887296
SET max_heap_table_size=16384;
SELECT SUM(DISTINCT id) sm FROM t2;
sm
536887296
DROP TABLE t1;
DROP TABLE t2;