diff options
author | Igor Babaev <igor@askmonty.org> | 2013-01-21 11:47:45 -0800 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2013-01-21 11:47:45 -0800 |
commit | fade3647ecb18a90d9c89a924a076d714ec45888 (patch) | |
tree | 1cdd64f9b996aa56df1993d3ea319075124ec5c4 /mysql-test/t/sum_distinct-big.test | |
parent | 2e11ca36f28133c18b72351d176ee2fd7fcbc465 (diff) | |
download | mariadb-git-fade3647ecb18a90d9c89a924a076d714ec45888.tar.gz |
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.
Diffstat (limited to 'mysql-test/t/sum_distinct-big.test')
-rw-r--r-- | mysql-test/t/sum_distinct-big.test | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/mysql-test/t/sum_distinct-big.test b/mysql-test/t/sum_distinct-big.test index 0859f4b3d89..d3710056c9a 100644 --- a/mysql-test/t/sum_distinct-big.test +++ b/mysql-test/t/sum_distinct-big.test @@ -63,5 +63,22 @@ SELECT SUM(DISTINCT id) sm FROM t1; SELECT SUM(DISTINCT id) sm FROM t2; SELECT SUM(DISTINCT id) sm FROM t1 GROUP BY id % 13; +--echo # +--echo # Bug mdev-4063: SUM(DISTINCT...) with small'max_heap_table_size +--echo # (bug #56927) +--echo # + +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; + +SET max_heap_table_size=16384; + +SELECT SUM(DISTINCT id) sm FROM t2; + DROP TABLE t1; DROP TABLE t2; |