1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Merge bk-internal.mysql.com:/home/bk/mysql-5.1-new

into  mysql.com:/home/dlenev/mysql-5.1-merges


sql/sql_table.cc:
  Auto merged
This commit is contained in:
unknown
2006-03-25 02:24:04 +03:00
5 changed files with 107 additions and 15 deletions

View File

@ -2130,15 +2130,6 @@ bool mysql_create_table_internal(THD *thd,
goto err;
part_info->part_info_string= part_syntax_buf;
part_info->part_info_len= syntax_len;
if (create_info->db_type != engine_type)
{
delete file;
if (!(file= get_new_handler((TABLE_SHARE*) 0, thd->mem_root, engine_type)))
{
mem_alloc_error(sizeof(handler));
DBUG_RETURN(TRUE);
}
}
if ((!(engine_type->partition_flags &&
engine_type->partition_flags() & HA_CAN_PARTITION)) ||
create_info->db_type == &partition_hton)
@ -2155,6 +2146,41 @@ bool mysql_create_table_internal(THD *thd,
{
DBUG_RETURN(TRUE);
}
/*
If we have default number of partitions or subpartitions we
might require to set-up the part_info object such that it
creates a proper .par file. The current part_info object is
only used to create the frm-file and .par-file.
*/
if (part_info->use_default_no_partitions &&
part_info->no_parts &&
(int)part_info->no_parts != file->get_default_no_partitions(0ULL))
{
uint i;
List_iterator<partition_element> part_it(part_info->partitions);
part_it++;
DBUG_ASSERT(thd->lex->sql_command != SQLCOM_CREATE_TABLE);
for (i= 1; i < part_info->partitions.elements; i++)
(part_it++)->part_state= PART_TO_BE_DROPPED;
}
else if (part_info->is_sub_partitioned() &&
part_info->use_default_no_subpartitions &&
part_info->no_subparts &&
(int)part_info->no_subparts !=
file->get_default_no_partitions(0ULL))
{
DBUG_ASSERT(thd->lex->sql_command != SQLCOM_CREATE_TABLE);
part_info->no_subparts= file->get_default_no_partitions(0ULL);
}
}
else if (create_info->db_type != engine_type)
{
delete file;
if (!(file= get_new_handler((TABLE_SHARE*) 0, thd->mem_root, engine_type)))
{
mem_alloc_error(sizeof(handler));
DBUG_RETURN(TRUE);
}
}
}
#endif