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

Merge dator5.(none):/home/pappa/clean-mysql-5.1

into  dator5.(none):/home/pappa/bug18198
This commit is contained in:
mikael/pappa@dator5.(none)
2006-07-31 05:42:06 -04:00
15 changed files with 243 additions and 141 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,43 @@ 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_fields()
part_info Partition info
ptr Array of Field pointers
RETURN VALUES
FALSE Success
TRUE Error
*/
static bool check_part_func_fields(Field **ptr)
{
Field *field;
while ((field= *(ptr++)))
{
/*
For CHAR/VARCHAR fields we need to take special precautions.
Binary collation with CHAR is automatically supported. Other
types need some kind of standardisation function handling
*/
if (field->type() == MYSQL_TYPE_STRING ||
field->type() == MYSQL_TYPE_VARCHAR)
{
CHARSET_INFO *cs= ((Field_str*)field)->charset();
if (field->type() == MYSQL_TYPE_STRING &&
cs->state & MY_CS_BINSORT)
return FALSE;
return TRUE;
}
}
return FALSE;
}
/*
fix partition functions
@ -1514,6 +1553,13 @@ bool fix_partition_func(THD *thd, TABLE *table,
goto end;
}
}
if ((check_part_func_fields(part_info->part_field_array)) ||
(part_info->is_sub_partitioned() &&
check_part_func_fields(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)))
@ -4544,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);
}