1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

BUG#18198: Less flexibility in defining partition functions

Changed test for functions if they are supported.
3 categories:
1) Fully supported
2) Supported for single character collations
3) Supported for binary collations
This commit is contained in:
mikael@dator5.(none)
2006-06-23 01:21:26 -04:00
parent d35c7f2f50
commit 5771a711f0
12 changed files with 262 additions and 140 deletions

View File

@ -525,6 +525,7 @@ static bool set_up_field_array(TABLE *table,
}
/*
Create a field array including all fields of both the partitioning and the
subpartitioning functions.
@ -549,6 +550,7 @@ static bool create_full_part_field_array(TABLE *table,
partition_info *part_info)
{
bool result= FALSE;
Field **ptr;
DBUG_ENTER("create_full_part_field_array");
if (!part_info->is_sub_partitioned())
@ -558,7 +560,7 @@ static bool create_full_part_field_array(TABLE *table,
}
else
{
Field **ptr, *field, **field_array;
Field *field, **field_array;
uint no_part_fields=0, size_field_array;
ptr= table->field;
while ((field= *(ptr++)))
@ -1369,6 +1371,38 @@ static uint32 get_part_id_from_linear_hash(longlong hash_value, uint mask,
return part_id;
}
/*
Check that partition function do not contain any forbidden
character sets and collations.
SYNOPSIS
check_part_func_collation()
part_info Partition info
ptr Array of Field pointers
RETURN VALUES
FALSE Success
TRUE Error
*/
static bool check_part_func_collation(int collation_allowed,
Field **ptr)
{
Field *field;
while ((field= *(ptr++)))
{
if (field->result_type() == STRING_RESULT)
{
CHARSET_INFO *cs= ((Field_str*)field)->charset();
if (use_strnxfrm(cs) ||
(collation_allowed == PF_SAFE_BINARY_COLLATION &&
(!(cs->state & MY_CS_BINSORT))))
return TRUE;
}
}
return FALSE;
}
/*
fix partition functions
@ -1514,6 +1548,17 @@ bool fix_partition_func(THD *thd, TABLE *table,
goto end;
}
}
if (((part_info->pf_collation_allowed != PF_SAFE) &&
check_part_func_collation(part_info->pf_collation_allowed,
part_info->part_field_array)) ||
(part_info->is_sub_partitioned() &&
part_info->spf_collation_allowed != PF_SAFE &&
check_part_func_collation(part_info->spf_collation_allowed,
part_info->subpart_field_array)))
{
my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0));
goto end;
}
if (unlikely(create_full_part_field_array(table, part_info)))
goto end;
if (unlikely(check_primary_key(table)))
@ -4545,7 +4590,7 @@ the generated partition syntax in a correct manner.
tab_part_info->use_default_no_subpartitions= FALSE;
}
if (tab_part_info->check_partition_info(thd, (handlerton**)NULL,
table->file, ULL(0)))
table->file, ULL(0), FALSE))
{
DBUG_RETURN(TRUE);
}