summaryrefslogtreecommitdiff
path: root/sql/sql_partition.cc
diff options
context:
space:
mode:
authorMattias Jonsson <mattias.jonsson@sun.com>2009-11-09 11:26:01 +0100
committerMattias Jonsson <mattias.jonsson@sun.com>2009-11-09 11:26:01 +0100
commit785b5c4e7a06445d2b23b57c3dce120828844c69 (patch)
tree276919687280ebbecc2130dd04a21f2945f33957 /sql/sql_partition.cc
parent5594215c5877d3b69afb3bf93ba3e656cf2f95f9 (diff)
downloadmariadb-git-785b5c4e7a06445d2b23b57c3dce120828844c69.tar.gz
Bug#48276: can't add column if subpartition exists
Bug when setting up default partitioning, used an uninitialized variabe. mysql-test/r/partition.result: Bug#48276: can't add column if subpartition exists Added result mysql-test/t/partition.test: Bug#48276: can't add column if subpartition exists Added test sql/sql_partition.cc: Bug#48276: can't add column if subpartition exists even if is_create_table_ind was set, one tried to set no_subparts with the unitialized no_parts local variable. Fixed by rearrange the code to be to only execute the statements when is_create_table_ind was not set.
Diffstat (limited to 'sql/sql_partition.cc')
-rw-r--r--sql/sql_partition.cc31
1 files changed, 16 insertions, 15 deletions
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 04d22174c8e..9f1844d746c 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -196,26 +196,27 @@ bool partition_default_handling(TABLE *table, partition_info *part_info,
{
DBUG_ENTER("partition_default_handling");
- if (part_info->use_default_no_partitions)
+ if (!is_create_table_ind)
{
- if (!is_create_table_ind &&
- table->file->get_no_parts(normalized_path, &part_info->no_parts))
+ if (part_info->use_default_no_partitions)
{
- DBUG_RETURN(TRUE);
+ if (table->file->get_no_parts(normalized_path, &part_info->no_parts))
+ {
+ DBUG_RETURN(TRUE);
+ }
}
- }
- else if (part_info->is_sub_partitioned() &&
- part_info->use_default_no_subpartitions)
- {
- uint no_parts;
- if (!is_create_table_ind &&
- (table->file->get_no_parts(normalized_path, &no_parts)))
+ else if (part_info->is_sub_partitioned() &&
+ part_info->use_default_no_subpartitions)
{
- DBUG_RETURN(TRUE);
+ uint no_parts;
+ if (table->file->get_no_parts(normalized_path, &no_parts))
+ {
+ DBUG_RETURN(TRUE);
+ }
+ DBUG_ASSERT(part_info->no_parts > 0);
+ DBUG_ASSERT((no_parts % part_info->no_parts) == 0);
+ part_info->no_subparts= no_parts / part_info->no_parts;
}
- DBUG_ASSERT(part_info->no_parts > 0);
- part_info->no_subparts= no_parts / part_info->no_parts;
- DBUG_ASSERT((no_parts % part_info->no_parts) == 0);
}
part_info->set_up_defaults_for_partitioning(table->file,
(ulonglong)0, (uint)0);