mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/usr/home/ram/work/5.0.b9489
This commit is contained in:
commit
e7243a9456
8 changed files with 74 additions and 2 deletions
|
@ -255,6 +255,9 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
|
|||
if (*pos) /* Found null */
|
||||
{
|
||||
nr^= (nr << 1) | 1;
|
||||
/* Add key pack length (2) to key for VARCHAR segments */
|
||||
if (seg->type == HA_KEYTYPE_VARTEXT1)
|
||||
key+= 2;
|
||||
continue;
|
||||
}
|
||||
pos++;
|
||||
|
@ -390,6 +393,9 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
|
|||
if (*pos)
|
||||
{
|
||||
nr^= (nr << 1) | 1;
|
||||
/* Add key pack length (2) to key for VARCHAR segments */
|
||||
if (seg->type == HA_KEYTYPE_VARTEXT1)
|
||||
key+= 2;
|
||||
continue;
|
||||
}
|
||||
pos++;
|
||||
|
@ -584,7 +590,12 @@ int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key)
|
|||
if (found_null != (int) *key++)
|
||||
return 1;
|
||||
if (found_null)
|
||||
{
|
||||
/* Add key pack length (2) to key for VARCHAR segments */
|
||||
if (seg->type == HA_KEYTYPE_VARTEXT1)
|
||||
key+= 2;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (seg->type == HA_KEYTYPE_TEXT)
|
||||
{
|
||||
|
|
|
@ -242,7 +242,10 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
|
|||
{
|
||||
k_length-=length;
|
||||
if (keyseg->flag & (HA_VAR_LENGTH_PART | HA_BLOB_PART))
|
||||
{
|
||||
k_length-=2; /* Skip length */
|
||||
old+= 2;
|
||||
}
|
||||
continue; /* Found NULL */
|
||||
}
|
||||
}
|
||||
|
|
|
@ -226,3 +226,13 @@ create table t1 (v varchar(65530), key(v(10)));
|
|||
insert into t1 values(repeat('a',65530));
|
||||
select length(v) from t1 where v=repeat('a',65530);
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #9489: problem with hash indexes
|
||||
#
|
||||
|
||||
create table t1(a int, b varchar(12), key ba(b, a));
|
||||
insert into t1 values (1, 'A'), (20, NULL);
|
||||
explain select * from t1 where a=20 and b is null;
|
||||
select * from t1 where a=20 and b is null;
|
||||
drop table t1;
|
||||
|
|
|
@ -1858,6 +1858,15 @@ select length(v) from t1 where v=repeat('a',65530);
|
|||
length(v)
|
||||
65530
|
||||
drop table t1;
|
||||
create table t1(a int, b varchar(12), key ba(b, a));
|
||||
insert into t1 values (1, 'A'), (20, NULL);
|
||||
explain select * from t1 where a=20 and b is null;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref ba ba 20 const,const 1 Using where
|
||||
select * from t1 where a=20 and b is null;
|
||||
a b
|
||||
20 NULL
|
||||
drop table t1;
|
||||
create table t1 (v varchar(65530), key(v));
|
||||
Warnings:
|
||||
Warning 1071 Specified key was too long; max key length is 255 bytes
|
||||
|
|
|
@ -2359,6 +2359,15 @@ select length(v) from t1 where v=repeat('a',65530);
|
|||
length(v)
|
||||
65530
|
||||
drop table t1;
|
||||
create table t1(a int, b varchar(12), key ba(b, a));
|
||||
insert into t1 values (1, 'A'), (20, NULL);
|
||||
explain select * from t1 where a=20 and b is null;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref ba ba 20 const,const 1 Using where; Using index
|
||||
select * from t1 where a=20 and b is null;
|
||||
a b
|
||||
20 NULL
|
||||
drop table t1;
|
||||
create table t1 (v varchar(65530), key(v));
|
||||
ERROR HY000: Can't create table './test/t1' (errno: 139)
|
||||
create table t1 (v varchar(65536));
|
||||
|
|
|
@ -1157,6 +1157,15 @@ select length(v) from t1 where v=repeat('a',65530);
|
|||
length(v)
|
||||
65530
|
||||
drop table t1;
|
||||
create table t1(a int, b varchar(12), key ba(b, a));
|
||||
insert into t1 values (1, 'A'), (20, NULL);
|
||||
explain select * from t1 where a=20 and b is null;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref ba ba 20 const,const 1 Using where; Using index
|
||||
select * from t1 where a=20 and b is null;
|
||||
a b
|
||||
20 NULL
|
||||
drop table t1;
|
||||
create table t1 (v varchar(65530), key(v));
|
||||
Warnings:
|
||||
Warning 1071 Specified key was too long; max key length is 1000 bytes
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
drop table if exists t1;
|
||||
drop table if exists t1, t2;
|
||||
create table t1 (v varchar(30), c char(3), e enum('abc','def','ghi'), t text);
|
||||
truncate table vchar;
|
||||
show create table t1;
|
||||
|
@ -383,3 +383,12 @@ select * from t1;
|
|||
pkcol othercol
|
||||
test somethingelse
|
||||
drop table t1;
|
||||
create table t1 (a int, b varchar(12));
|
||||
insert into t1 values (1, 'A'), (22, NULL);
|
||||
create table t2 (a int);
|
||||
insert into t2 values (22), (22);
|
||||
select t1.a, t1.b, min(t1.b) from t1 inner join t2 ON t2.a = t1.a
|
||||
group by t1.b, t1.a;
|
||||
a b min(t1.b)
|
||||
22 NULL NULL
|
||||
drop table t1, t2;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop table if exists t1, t2;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (v varchar(30), c char(3), e enum('abc','def','ghi'), t text);
|
||||
|
@ -106,3 +106,15 @@ insert into t1 values ('test', 'something');
|
|||
update t1 set othercol='somethingelse' where pkcol='test';
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #9489: problems with key handling
|
||||
#
|
||||
|
||||
create table t1 (a int, b varchar(12));
|
||||
insert into t1 values (1, 'A'), (22, NULL);
|
||||
create table t2 (a int);
|
||||
insert into t2 values (22), (22);
|
||||
select t1.a, t1.b, min(t1.b) from t1 inner join t2 ON t2.a = t1.a
|
||||
group by t1.b, t1.a;
|
||||
drop table t1, t2;
|
||||
|
|
Loading…
Reference in a new issue