diff options
author | unknown <sergefp@mysql.com> | 2007-09-14 14:53:13 +0400 |
---|---|---|
committer | unknown <sergefp@mysql.com> | 2007-09-14 14:53:13 +0400 |
commit | 466747d57081b4bdfe166ff16da8ac9da99900e4 (patch) | |
tree | 366498aa227f237ef0ac7c133a28cc69a402fdb3 /mysql-test/t/type_bit.test | |
parent | ee0b7d895d42b0e3c93bdbffa7c4d3f51c1f60c2 (diff) | |
download | mariadb-git-466747d57081b4bdfe166ff16da8ac9da99900e4.tar.gz |
BUG#30324: Grouping queries with COUNT(DISTINCT bit column) return wrong results
- The bug was caused by COUNT(DISTINCT ...) code using Unique object in
a way that assumed that BIT(N) column occupies a contiguous space in
temp_table->record[0] buffer.
- The fix is to make COUNT(DISTINCT ...) code instruct create_tmp_table to
create temporary table with column of type BIGINT, not BIT(N).
mysql-test/r/type_bit.result:
BUG#30324: Grouping queries with COUNT(DISTINCT bit column) return wrong results
- Testcase
mysql-test/t/type_bit.test:
BUG#30324: Grouping queries with COUNT(DISTINCT bit column) return wrong results
- Testcase
sql/item_sum.cc:
BUG#30324: Grouping queries with COUNT(DISTINCT bit column) return wrong results
- Make COUNT(DISTINCT ...) code instruct create_tmp_table to create
temporary table with BIGINT, not BIT(N) column.
Diffstat (limited to 'mysql-test/t/type_bit.test')
-rw-r--r-- | mysql-test/t/type_bit.test | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/mysql-test/t/type_bit.test b/mysql-test/t/type_bit.test index 66538f59c6f..4978f55d776 100644 --- a/mysql-test/t/type_bit.test +++ b/mysql-test/t/type_bit.test @@ -304,4 +304,18 @@ SELECT b FROM t1 GROUP BY b; --disable_metadata DROP TABLE t1; +# +# BUG#30324 Wrong query result for COUNT(DISTINCT(bit_column)) +# +CREATE TABLE t1 (a int, b bit(2)); +INSERT INTO t1 VALUES (3, 2), (2, 3), (2, 0), (3, 2), (3, 1); +SELECT COUNT(DISTINCT b) FROM t1 GROUP BY a; +DROP TABLE t1; + +create table t2 (a int, b bit(2), c char(10)); +INSERT INTO t2 VALUES (3, 2, 'two'), (2, 3, 'three'), (2, 0, 'zero'), + (3, 2, 'two'), (3, 1, 'one'); +SELECT COUNT(DISTINCT b,c) FROM t2 GROUP BY a; +DROP TABLE t2; + --echo End of 5.0 tests |