Commit b0f3107f authored by unknown's avatar unknown
Browse files

Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-5.1-kt

into  mysql.com:/usr/home/bar/mysql-5.1.b20086

parents bc6759bf c06d8fa1
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -92,3 +92,18 @@ DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t0_aux;
DROP TABLE IF EXISTS t0_definition;
DROP TABLE IF EXISTS t0_template;
create table t1 (id varchar(64) primary key) engine=innodb
partition by key(id) partitions 5;
insert into t1 values ('a');
insert into t1 values ('aa');
insert into t1 values ('aaa');
select * from t1 where id = 'a';
id
a
select * from t1 where id = 'aa';
id
aa
select * from t1 where id = 'aaa';
id
aaa
drop table t1;
+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1	SIMPLE	t2	p0,p1	ALL	NULL	NULL	NULL	NULL	3	Using where
explain partitions select * from t2 where a=1 and b=1;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t2	p0	ALL	NULL	NULL	NULL	NULL	3	Using where
1	SIMPLE	t2	p0	ALL	NULL	NULL	NULL	NULL	2	Using where
create table t3 (
a int
)
+12 −0
Original line number Diff line number Diff line
@@ -66,3 +66,15 @@ DROP TABLE IF EXISTS t0_definition;
DROP TABLE IF EXISTS t0_template;
--enable_warnings

#
# Bug#20086: Can't get data from key partitioned tables with VARCHAR key
#
create table t1 (id varchar(64) primary key) engine=innodb
partition by key(id) partitions 5;
insert into t1 values ('a');
insert into t1 values ('aa');
insert into t1 values ('aaa');
select * from t1 where id = 'a';
select * from t1 where id = 'aa';
select * from t1 where id = 'aaa';
drop table t1;
+30 −0
Original line number Diff line number Diff line
@@ -1243,6 +1243,21 @@ uint Field::offset()
}


void Field::hash(ulong *nr, ulong *nr2)
{
  if (is_null())
  {
    *nr^= (*nr << 1) | 1;
  }
  else
  {
    uint len= pack_length();
    CHARSET_INFO *cs= charset();
    cs->coll->hash_sort(cs, (uchar*) ptr, len, nr, nr2);
  }
}


void Field::copy_from_tmp(int row_offset)
{
  memcpy(ptr,ptr+row_offset,pack_length());
@@ -6925,6 +6940,21 @@ uint Field_varstring::is_equal(create_field *new_field)
}


void Field_varstring::hash(ulong *nr, ulong *nr2)
{
  if (is_null())
  {
    *nr^= (*nr << 1) | 1;
  }
  else
  {
    uint len=  length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr);
    CHARSET_INFO *cs= charset();
    cs->coll->hash_sort(cs, (uchar*) ptr + length_bytes, len, nr, nr2);
  }
}


/****************************************************************************
** blob type
** A blob is saved as a length and a pointer. The length is stored in the
+3 −0
Original line number Diff line number Diff line
@@ -351,6 +351,8 @@ class Field
    return field_length / charset()->mbmaxlen;
  }

  /* Hash value */
  virtual void hash(ulong *nr, ulong *nr2);
  friend bool reopen_table(THD *,struct st_table *,bool);
  friend int cre_myisam(my_string name, register TABLE *form, uint options,
			ulonglong auto_increment_value);
@@ -1120,6 +1122,7 @@ class Field_varstring :public Field_longstr {
                       char *new_ptr, uchar *new_null_ptr,
                       uint new_null_bit);
  uint is_equal(create_field *new_field);
  void hash(ulong *nr, ulong *nr2);
};


Loading