Commit 1727aec6 authored by unknown's avatar unknown

BUG#19067: Alter table add partition for subpartitioned table crashes

Changed variable name for improved clarity and debugging possibilities
Fixed bug in not assigning subpart_type


mysql-test/t/partition.test:
  Added new test case
sql/partition_info.cc:
  Changed variable name for improved clarity and debugging possibilities
  Fixed bug in not assigning subpart_type
sql/sql_partition.cc:
  Changed variable name for improved clarity and debugging possibilities
  Fixed bug in not assigning subpart_type
parent cbdc730a
...@@ -1009,4 +1009,15 @@ select auto_increment from information_schema.tables where table_name='t1'; ...@@ -1009,4 +1009,15 @@ select auto_increment from information_schema.tables where table_name='t1';
select * from t1; select * from t1;
drop table t1; drop table t1;
#
# BUG 19067 ALTER TABLE .. ADD PARTITION for subpartitioned table crashes
#
create table t1 (a int)
partition by range (a)
subpartition by key (a)
(partition p0 values less than (1));
alter table t1 add partition (partition p1 values less than (2));
alter table t1 reorganize partition p1 into (partition p1 values less than (3));
drop table t1;
--echo End of 5.1 tests --echo End of 5.1 tests
...@@ -714,18 +714,18 @@ bool partition_info::check_partition_info(handlerton **eng_type, ...@@ -714,18 +714,18 @@ bool partition_info::check_partition_info(handlerton **eng_type,
List_iterator<partition_element> sub_it(part_elem->subpartitions); List_iterator<partition_element> sub_it(part_elem->subpartitions);
do do
{ {
part_elem= sub_it++; partition_element *sub_elem= sub_it++;
if (check_table_name(part_elem->partition_name, if (check_table_name(sub_elem->partition_name,
strlen(part_elem->partition_name))) strlen(sub_elem->partition_name)))
{ {
my_error(ER_WRONG_PARTITION_NAME, MYF(0)); my_error(ER_WRONG_PARTITION_NAME, MYF(0));
goto end; goto end;
} }
if (part_elem->engine_type == NULL) if (sub_elem->engine_type == NULL)
part_elem->engine_type= default_engine_type; sub_elem->engine_type= default_engine_type;
DBUG_PRINT("info", ("engine = %u", DBUG_PRINT("info", ("engine = %u",
ha_legacy_type(part_elem->engine_type))); ha_legacy_type(sub_elem->engine_type)));
engine_array[part_count++]= part_elem->engine_type; engine_array[part_count++]= sub_elem->engine_type;
} while (++j < no_subparts); } while (++j < no_subparts);
} }
} while (++i < no_parts); } while (++i < no_parts);
......
...@@ -3949,6 +3949,7 @@ uint prep_alter_part_table(THD *thd, TABLE *table, ALTER_INFO *alter_info, ...@@ -3949,6 +3949,7 @@ uint prep_alter_part_table(THD *thd, TABLE *table, ALTER_INFO *alter_info,
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
alt_part_info->part_type= tab_part_info->part_type; alt_part_info->part_type= tab_part_info->part_type;
alt_part_info->subpart_type= tab_part_info->subpart_type;
if (alt_part_info->set_up_defaults_for_partitioning(table->file, if (alt_part_info->set_up_defaults_for_partitioning(table->file,
ULL(0), ULL(0),
tab_part_info->no_parts)) tab_part_info->no_parts))
......
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