Commit 81db111e authored by mikael@dator3.(none)'s avatar mikael@dator3.(none)

BUG#18198

Added new test cases, fixed bugs in relation to those
parent 647ca9f0
...@@ -16,3 +16,9 @@ s1 ...@@ -16,3 +16,9 @@ s1
1 1
3 3
drop table t1; 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; ...@@ -295,3 +295,7 @@ select * from t1;
a a
100 100
drop table t1; 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); ...@@ -179,7 +179,7 @@ insert into t1 values (null);
select * from t1; select * from t1;
drop table t1; drop table t1;
-- error ER_PARTITION_FUNC_NOT_ALLOWED --error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
create table t1 (a char(1)) create table t1 (a char(1))
partition by list (ascii(ucase(a))) partition by list (ascii(ucase(a)))
(partition p1 values in (2)); (partition p1 values in (2));
......
...@@ -951,6 +951,7 @@ bool partition_info::set_up_charset_field_preps() ...@@ -951,6 +951,7 @@ bool partition_info::set_up_charset_field_preps()
if (!(char_ptrs= (char**)sql_alloc(size))) if (!(char_ptrs= (char**)sql_alloc(size)))
goto error; goto error;
subpart_charset_field_array= (Field**)char_ptrs; subpart_charset_field_array= (Field**)char_ptrs;
ptr= subpart_field_array;
i= 0; i= 0;
while ((field= *(ptr++))) while ((field= *(ptr++)))
{ {
......
...@@ -3315,13 +3315,16 @@ static uint32 get_sub_part_id_from_key(const TABLE *table,byte *buf, ...@@ -3315,13 +3315,16 @@ static uint32 get_sub_part_id_from_key(const TABLE *table,byte *buf,
uint32 part_id; uint32 part_id;
DBUG_ENTER("get_sub_part_id_from_key"); DBUG_ENTER("get_sub_part_id_from_key");
key_restore(buf, (byte*)key_spec->key, key_info, key_spec->length);
if (likely(rec0 == buf)) 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); part_id= part_info->get_subpartition_id(part_info);
}
else else
{ {
Field **part_field_array= part_info->subpart_field_array; Field **part_field_array= part_info->subpart_field_array;
set_field_ptr(part_field_array, buf, rec0); 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); part_id= part_info->get_subpartition_id(part_info);
set_field_ptr(part_field_array, rec0, buf); 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, ...@@ -3358,14 +3361,17 @@ bool get_part_id_from_key(const TABLE *table, byte *buf, KEY *key_info,
longlong func_value; longlong func_value;
DBUG_ENTER("get_part_id_from_key"); DBUG_ENTER("get_part_id_from_key");
key_restore(buf, (byte*)key_spec->key, key_info, key_spec->length);
if (likely(rec0 == buf)) 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, result= part_info->get_part_partition_id(part_info, part_id,
&func_value); &func_value);
}
else else
{ {
Field **part_field_array= part_info->part_field_array; Field **part_field_array= part_info->part_field_array;
set_field_ptr(part_field_array, buf, rec0); 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, result= part_info->get_part_partition_id(part_info, part_id,
&func_value); &func_value);
set_field_ptr(part_field_array, rec0, buf); set_field_ptr(part_field_array, rec0, buf);
...@@ -3405,14 +3411,17 @@ void get_full_part_id_from_key(const TABLE *table, byte *buf, ...@@ -3405,14 +3411,17 @@ void get_full_part_id_from_key(const TABLE *table, byte *buf,
longlong func_value; longlong func_value;
DBUG_ENTER("get_full_part_id_from_key"); DBUG_ENTER("get_full_part_id_from_key");
key_restore(buf, (byte*)key_spec->key, key_info, key_spec->length);
if (likely(rec0 == buf)) 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, result= part_info->get_partition_id(part_info, &part_spec->start_part,
&func_value); &func_value);
}
else else
{ {
Field **part_field_array= part_info->full_part_field_array; Field **part_field_array= part_info->full_part_field_array;
set_field_ptr(part_field_array, buf, rec0); 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, result= part_info->get_partition_id(part_info, &part_spec->start_part,
&func_value); &func_value);
set_field_ptr(part_field_array, rec0, buf); 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