summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/type_bit.result10
-rw-r--r--mysql-test/t/type_bit.test15
-rw-r--r--sql/key.cc13
3 files changed, 25 insertions, 13 deletions
diff --git a/mysql-test/r/type_bit.result b/mysql-test/r/type_bit.result
index 4c1b80c2fd5..917f78d8f17 100644
--- a/mysql-test/r/type_bit.result
+++ b/mysql-test/r/type_bit.result
@@ -672,4 +672,14 @@ COUNT(DISTINCT b,c)
2
2
DROP TABLE t2;
+CREATE TABLE t1(a BIT(13), KEY(a));
+INSERT INTO t1(a) VALUES
+(65535),(65525),(65535),(65535),(65535),(65535),(65535),(65535),(65535),(65535);
+EXPLAIN SELECT 1 FROM t1 GROUP BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range NULL a 3 NULL 6 Using index for group-by
+SELECT 1 FROM t1 GROUP BY a;
+1
+1
+DROP TABLE t1;
End of 5.0 tests
diff --git a/mysql-test/t/type_bit.test b/mysql-test/t/type_bit.test
index 4978f55d776..3095311bfbc 100644
--- a/mysql-test/t/type_bit.test
+++ b/mysql-test/t/type_bit.test
@@ -318,4 +318,19 @@ INSERT INTO t2 VALUES (3, 2, 'two'), (2, 3, 'three'), (2, 0, 'zero'),
SELECT COUNT(DISTINCT b,c) FROM t2 GROUP BY a;
DROP TABLE t2;
+#
+# BUG#32556 assert in "using index for group-by" : is_last_prefix <= 0,
+# file .\opt_range.cc
+
+CREATE TABLE t1(a BIT(13), KEY(a));
+--disable_warnings
+INSERT INTO t1(a) VALUES
+(65535),(65525),(65535),(65535),(65535),(65535),(65535),(65535),(65535),(65535);
+--enable_warnings
+
+EXPLAIN SELECT 1 FROM t1 GROUP BY a;
+SELECT 1 FROM t1 GROUP BY a;
+
+DROP TABLE t1;
+
--echo End of 5.0 tests
diff --git a/sql/key.cc b/sql/key.cc
index 2bdde46b6b3..1c044f3dc7d 100644
--- a/sql/key.cc
+++ b/sql/key.cc
@@ -106,19 +106,6 @@ void key_copy(byte *to_key, byte *from_record, KEY *key_info, uint key_length)
key_part->null_bit);
key_length--;
}
- if (key_part->type == HA_KEYTYPE_BIT)
- {
- Field_bit *field= (Field_bit *) (key_part->field);
- if (field->bit_len)
- {
- uchar bits= get_rec_bits((uchar*) from_record +
- key_part->null_offset +
- (key_part->null_bit == 128),
- field->bit_ofs, field->bit_len);
- *to_key++= bits;
- key_length--;
- }
- }
if (key_part->key_part_flag & HA_BLOB_PART ||
key_part->key_part_flag & HA_VAR_LENGTH_PART)
{