diff options
author | Mattias Jonsson <mattias.jonsson@sun.com> | 2010-04-21 15:32:27 -0700 |
---|---|---|
committer | Mattias Jonsson <mattias.jonsson@sun.com> | 2010-04-21 15:32:27 -0700 |
commit | c1966505a8ca4e9af2f3a4b6e5316e3787872310 (patch) | |
tree | 62894285b3b756fdb84e837ed0f95cb758ec8868 /sql/sql_partition.cc | |
parent | 20f5c421e7a70fa4338da34ab123002cf9b00ad3 (diff) | |
download | mariadb-git-c1966505a8ca4e9af2f3a4b6e5316e3787872310.tar.gz |
Bug#52815: LIST COLUMNS doesn't insert rows in correct
partition if muliple columns used
Problem was that range scanning through the sorted array of
the column list values did not use a correct index calculation.
Fixed by also taking the number of columns in the calculation.
mysql-test/r/partition_column.result:
Bug#52815: LIST COLUMNS doesn't insert rows in correct
partition if muliple columns used
Added test result for bug.
mysql-test/t/partition_column.test:
Bug#52815: LIST COLUMNS doesn't insert rows in correct
partition if muliple columns used
Added test for bug.
sql/sql_partition.cc:
Bug#52815: LIST COLUMNS doesn't insert rows in correct
partition if muliple columns used
list_col_array is a matrix of field values, so one must also
use the number of columns to calculate the correct partition
id.
Diffstat (limited to 'sql/sql_partition.cc')
-rw-r--r-- | sql/sql_partition.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 0eb92dc23a9..153d958a362 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -3096,7 +3096,7 @@ int get_partition_id_list_col(partition_info *part_info, } else { - *part_id= (uint32)list_col_array[list_index].partition_id; + *part_id= (uint32)list_col_array[list_index*num_columns].partition_id; DBUG_RETURN(0); } } @@ -7701,7 +7701,7 @@ uint32 get_next_partition_id_range(PARTITION_ITERATOR* part_iter) DESCRIPTION This implementation of PARTITION_ITERATOR::get_next() is special for LIST partitioning: it enumerates partition ids in - part_info->list_array[i] (list_col_array[i] for COLUMNS LIST + part_info->list_array[i] (list_col_array[i*cols] for COLUMNS LIST partitioning) where i runs over [min_idx, max_idx] interval. The function conforms to partition_iter_func type. @@ -7727,9 +7727,12 @@ uint32 get_next_partition_id_list(PARTITION_ITERATOR *part_iter) { partition_info *part_info= part_iter->part_info; uint32 num_part= part_iter->part_nums.cur++; - return part_info->column_list ? - part_info->list_col_array[num_part].partition_id : - part_info->list_array[num_part].partition_id; + if (part_info->column_list) + { + uint num_columns= part_info->part_field_list.elements; + return part_info->list_col_array[num_part*num_columns].partition_id; + } + return part_info->list_array[num_part].partition_id; } } |