Commit 0c567648 authored by Sachin's avatar Sachin

Revert (MDEV-18888)2b06de8064660c5c, fix it in different way And add test case for MDEV-18953

parent ef33e26f
......@@ -22,5 +22,3 @@ partition_open_files_limit : open_files_limit check broken by MDEV-18360
mysqlcheck : special tables like proxy , host specific to a system are shown
flush_read_lock : special tables like proxy , host specific to a system are shown
join_cache : enable after MDEV-17752 is fixed
ctype_utf8mb4_myisam : enable after MDEV-18953 is fixed
ctype_utf8mb4_innodb : enable after MDEV-18953 is fixed
......@@ -219,3 +219,19 @@ data
f
o
DROP TABLE t1;
create table t1 (
c char(10) character set utf8mb4,
unique key a using hash (c(1))
) engine=myisam;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c` char(10) CHARACTER SET utf8mb4 DEFAULT NULL,
UNIQUE KEY `a` (`c`(1)) USING HASH
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values ('б');
insert into t1 values ('бб');
ERROR 23000: Duplicate entry '' for key 'a'
insert into t1 values ('ббб');
ERROR 23000: Duplicate entry '' for key 'a'
drop table t1;
......@@ -250,3 +250,18 @@ SELECT * FROM t1;
DROP TABLE t1;
--let $datadir= `select @@datadir`
--remove_file $datadir/test/load.data
#
# MDEV-18953 Hash index on partial char field not working
#
create table t1 (
c char(10) character set utf8mb4,
unique key a using hash (c(1))
) engine=myisam;
show create table t1;
insert into t1 values ('б');
--error ER_DUP_ENTRY
insert into t1 values ('бб');
--error ER_DUP_ENTRY
insert into t1 values ('ббб');
drop table t1;
......@@ -1204,6 +1204,8 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table,
new (mem_root) Item_field(thd, keypart->field),
new (mem_root) Item_int(thd, length));
list_item->fix_fields(thd, NULL);
keypart->field->vcol_info=
table->field[keypart->field->field_index]->vcol_info;
}
else
list_item= new (mem_root) Item_field(thd, keypart->field);
......@@ -3710,14 +3712,8 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share,
for ( ; key_part < key_part_end; key_part++)
{
Field *field= key_part->field= outparam->field[key_part->fieldnr - 1];
/*
There's no need to create a prefix
Field for HA_KEY_ALG_LONG_HASH indexes, as they implement prefixing via
Iten_func_left anyway (see parse_vcol_defs())
*/
if (field->key_length() != key_part->length &&
!(field->flags & BLOB_FLAG) &&
key_info->algorithm != HA_KEY_ALG_LONG_HASH)
!(field->flags & BLOB_FLAG))
{
/*
We are using only a prefix of the column as a key:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment