Commit 2a2b1ea8 authored by unknown's avatar unknown

BUG#18198

Added new test cases, fixed bugs in relation to those


mysql-test/r/partition_charset.result:
  New test case
mysql-test/r/partition_list.result:
  New test case
mysql-test/t/partition_list.test:
  New test case
sql/partition_info.cc:
  Missing initialisation
sql/sql_partition.cc:
  key_restore made use of field->ptr in VARCHAR fields and
  when used with REPLACE it caused the key_restore to
  become against table->record[0] when buf pointed to
  table->record[1]
parent 61aaff4a
......@@ -16,3 +16,9 @@ s1
1
3
drop table t1;
create table t1 (a varchar(1), primary key (a))
partition by list (ascii(a))
(partition p1 values in (65));
insert into t1 values ('A');
replace into t1 values ('A');
drop table t1;
......@@ -295,3 +295,7 @@ select * from t1;
a
100
drop table t1;
create table t1 (a char(1))
partition by list (ascii(ucase(a)))
(partition p1 values in (2));
ERROR HY000: This partition function is not allowed
......@@ -179,7 +179,7 @@ insert into t1 values (null);
select * from t1;
drop table t1;
-- error ER_PARTITION_FUNC_NOT_ALLOWED
--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
create table t1 (a char(1))
partition by list (ascii(ucase(a)))
(partition p1 values in (2));
......
......@@ -951,6 +951,7 @@ bool partition_info::set_up_charset_field_preps()
if (!(char_ptrs= (char**)sql_alloc(size)))
goto error;
subpart_charset_field_array= (Field**)char_ptrs;
ptr= subpart_field_array;
i= 0;
while ((field= *(ptr++)))
{
......
......@@ -3315,13 +3315,16 @@ static uint32 get_sub_part_id_from_key(const TABLE *table,byte *buf,
uint32 part_id;
DBUG_ENTER("get_sub_part_id_from_key");
key_restore(buf, (byte*)key_spec->key, key_info, key_spec->length);
if (likely(rec0 == buf))
{
key_restore(buf, (byte*)key_spec->key, key_info, key_spec->length);
part_id= part_info->get_subpartition_id(part_info);
}
else
{
Field **part_field_array= part_info->subpart_field_array;
set_field_ptr(part_field_array, buf, rec0);
key_restore(buf, (byte*)key_spec->key, key_info, key_spec->length);
part_id= part_info->get_subpartition_id(part_info);
set_field_ptr(part_field_array, rec0, buf);
}
......@@ -3358,14 +3361,17 @@ bool get_part_id_from_key(const TABLE *table, byte *buf, KEY *key_info,
longlong func_value;
DBUG_ENTER("get_part_id_from_key");
key_restore(buf, (byte*)key_spec->key, key_info, key_spec->length);
if (likely(rec0 == buf))
{
key_restore(buf, (byte*)key_spec->key, key_info, key_spec->length);
result= part_info->get_part_partition_id(part_info, part_id,
&func_value);
}
else
{
Field **part_field_array= part_info->part_field_array;
set_field_ptr(part_field_array, buf, rec0);
key_restore(buf, (byte*)key_spec->key, key_info, key_spec->length);
result= part_info->get_part_partition_id(part_info, part_id,
&func_value);
set_field_ptr(part_field_array, rec0, buf);
......@@ -3405,14 +3411,17 @@ void get_full_part_id_from_key(const TABLE *table, byte *buf,
longlong func_value;
DBUG_ENTER("get_full_part_id_from_key");
key_restore(buf, (byte*)key_spec->key, key_info, key_spec->length);
if (likely(rec0 == buf))
{
key_restore(buf, (byte*)key_spec->key, key_info, key_spec->length);
result= part_info->get_partition_id(part_info, &part_spec->start_part,
&func_value);
}
else
{
Field **part_field_array= part_info->full_part_field_array;
set_field_ptr(part_field_array, buf, rec0);
key_restore(buf, (byte*)key_spec->key, key_info, key_spec->length);
result= part_info->get_partition_id(part_info, &part_spec->start_part,
&func_value);
set_field_ptr(part_field_array, rec0, buf);
......
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