diff options
author | Mattias Jonsson <mattias.jonsson@sun.com> | 2010-03-12 11:52:38 +0100 |
---|---|---|
committer | Mattias Jonsson <mattias.jonsson@sun.com> | 2010-03-12 11:52:38 +0100 |
commit | e62c30b5f8cc6b2c63dc8d956056af347cc590fe (patch) | |
tree | 3556b3fe7aec95558a3b6926e3dd9fb8cfc38f3f /sql/sql_partition.cc | |
parent | 7871605bcff6181de4cc060fca0516c1efe913e8 (diff) | |
parent | 29b39e7a4423188d99570b290127a74151805ed5 (diff) | |
download | mariadb-git-e62c30b5f8cc6b2c63dc8d956056af347cc590fe.tar.gz |
merge
Diffstat (limited to 'sql/sql_partition.cc')
-rw-r--r-- | sql/sql_partition.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index f12194d7771..395156dcd63 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -2876,6 +2876,7 @@ int get_partition_id_range(partition_info *part_info, *func_value= part_func_value; if (unsigned_flag) part_func_value-= 0x8000000000000000ULL; + /* Search for the partition containing part_func_value */ while (max_part_id > min_part_id) { loc_part_id= (max_part_id + min_part_id) / 2; @@ -3015,11 +3016,17 @@ uint32 get_partition_id_range_for_endpoint(partition_info *part_info, part_end_val= range_array[loc_part_id]; if (left_endpoint) { + DBUG_ASSERT(part_func_value > part_end_val ? + (loc_part_id == max_partition && + !part_info->defined_max_value) : + 1); /* In case of PARTITION p VALUES LESS THAN MAXVALUE - the maximum value is in the current partition. + the maximum value is in the current (last) partition. + If value is equal or greater than the endpoint, + the range starts from the next partition. */ - if (part_func_value == part_end_val && + if (part_func_value >= part_end_val && (loc_part_id < max_partition || !part_info->defined_max_value)) loc_part_id++; } |