1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

BUG#19801: Valgrind error in check_list_constants

Needed some special handling of the case when no_list_values == 0


mysql-test/r/partition.result:
  Added a couple of new test cases
mysql-test/t/partition.test:
  Added a couple of new test cases
sql/partition_info.cc:
  Rearranged some code to handle case where no_list_values == 0 which
  happens when one partition with only one value == NULL.
sql/sql_partition.cc:
  Rearranged code to remove compiler warning and also since we
  now have handled the case where no_list_values == 0 in a special
  case before coming here
  Added code for handling the special case where no_list_values == 0
This commit is contained in:
unknown
2006-05-30 00:08:48 -04:00
parent e05d55de5f
commit 10c5b8b6fd
4 changed files with 58 additions and 22 deletions

View File

@@ -2257,8 +2257,8 @@ static uint32 get_part_id_linear_key(partition_info *part_info,
int get_partition_id_list(partition_info *part_info,
uint32 *part_id,
longlong *func_value)
uint32 *part_id,
longlong *func_value)
{
LIST_PART_ENTRY *list_array= part_info->list_array;
int list_index;
@@ -2351,7 +2351,8 @@ uint32 get_list_array_idx_for_endpoint(partition_info *part_info,
uint min_list_index= 0, max_list_index= part_info->no_list_values - 1;
/* Get the partitioning function value for the endpoint */
longlong part_func_value= part_val_int(part_info->part_expr);
while (max_list_index >= min_list_index)
DBUG_ASSERT(part_info->no_list_values);
do
{
list_index= (max_list_index + min_list_index) >> 1;
list_value= list_array[list_index].list_value;
@@ -2367,7 +2368,7 @@ uint32 get_list_array_idx_for_endpoint(partition_info *part_info,
{
DBUG_RETURN(list_index + test(left_endpoint ^ include_endpoint));
}
}
} while (max_list_index >= min_list_index);
notfound:
if (list_value < part_func_value)
list_index++;
@@ -6194,6 +6195,18 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info,
part_iter->get_next= get_next_partition_id_list;
part_iter->part_info= part_info;
part_iter->ret_null_part= part_iter->ret_null_part_orig= FALSE;
if (max_endpoint_val == 0)
{
/*
We handle this special case without optimisations since it is
of little practical value but causes a great number of complex
checks later in the code.
*/
part_iter->part_nums.start= part_iter->part_nums.end= 0;
part_iter->part_nums.cur= 0;
part_iter->ret_null_part= part_iter->ret_null_part_orig= TRUE;
return -1;
}
}
else
DBUG_ASSERT(0);