summaryrefslogtreecommitdiff
path: root/sql/sql_partition.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_partition.cc')
-rw-r--r--sql/sql_partition.cc28
1 files changed, 18 insertions, 10 deletions
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 811d7fd2529..668e8051f3f 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -1559,7 +1559,7 @@ static bool check_vers_constants(THD *thd, partition_info *part_info)
return 0;
part_info->range_int_array=
- (longlong*) thd->alloc(hist_parts * sizeof(longlong));
+ (longlong*) thd->alloc(part_info->num_parts * sizeof(longlong));
MYSQL_TIME ltime;
List_iterator<partition_element> it(part_info->partitions);
@@ -1578,6 +1578,9 @@ static bool check_vers_constants(THD *thd, partition_info *part_info)
if (vers_info->hist_part->range_value <= thd->query_start())
vers_info->hist_part= el;
}
+ DBUG_ASSERT(el == vers_info->now_part);
+ el->max_value= true;
+ part_info->range_int_array[el->id]= el->range_value= LONGLONG_MAX;
return 0;
err:
my_error(ER_DATA_OUT_OF_RANGE, MYF(0), "TIMESTAMP", "INTERVAL");
@@ -1971,7 +1974,6 @@ bool fix_partition_func(THD *thd, TABLE *table, bool is_create_table_ind)
}
}
DBUG_ASSERT(part_info->part_type != NOT_A_PARTITION);
- DBUG_ASSERT(part_info->part_type != VERSIONING_PARTITION || part_info->column_list);
/*
Partition is defined. We need to verify that partitioning
function is correct.
@@ -2004,15 +2006,15 @@ bool fix_partition_func(THD *thd, TABLE *table, bool is_create_table_ind)
{
if (part_info->column_list)
{
- if (part_info->part_type == VERSIONING_PARTITION &&
- part_info->vers_setup_expression(thd))
- goto end;
List_iterator<const char> it(part_info->part_field_list);
if (unlikely(handle_list_of_fields(thd, it, table, part_info, FALSE)))
goto end;
}
else
{
+ if (part_info->part_type == VERSIONING_PARTITION &&
+ part_info->vers_setup_expression(thd))
+ goto end;
if (unlikely(fix_fields_part_func(thd, part_info->part_expr,
table, FALSE, is_create_table_ind)))
goto end;
@@ -2028,7 +2030,8 @@ bool fix_partition_func(THD *thd, TABLE *table, bool is_create_table_ind)
goto end;
}
if (unlikely(!part_info->column_list &&
- part_info->part_expr->result_type() != INT_RESULT))
+ part_info->part_expr->result_type() != INT_RESULT &&
+ part_info->part_expr->result_type() != DECIMAL_RESULT))
{
part_info->report_part_expr_error(FALSE);
goto end;
@@ -2537,7 +2540,7 @@ static int add_partition_values(String *str, partition_info *part_info,
}
else if (part_info->part_type == VERSIONING_PARTITION)
{
- switch (p_elem->type())
+ switch (p_elem->type)
{
case partition_element::CURRENT:
err+= str->append(STRING_WITH_LEN(" CURRENT"));
@@ -5317,7 +5320,7 @@ that are reorganised.
partition_element *el;
while ((el= it++))
{
- if (el->type() == partition_element::CURRENT)
+ if (el->type == partition_element::CURRENT)
{
it.remove();
now_part= el;
@@ -5413,7 +5416,7 @@ that are reorganised.
{
if (tab_part_info->part_type == VERSIONING_PARTITION)
{
- if (part_elem->type() == partition_element::CURRENT)
+ if (part_elem->type == partition_element::CURRENT)
{
my_error(ER_VERS_WRONG_PARTS, MYF(0), table->s->table_name.str);
goto err;
@@ -7667,6 +7670,10 @@ static void set_up_range_analysis_info(partition_info *part_info)
partitioning
*/
switch (part_info->part_type) {
+ case VERSIONING_PARTITION:
+ if (!part_info->vers_info->interval.is_set())
+ break;
+ /* Fall through */
case RANGE_PARTITION:
case LIST_PARTITION:
if (!part_info->column_list)
@@ -8103,7 +8110,8 @@ static int get_part_iter_for_interval_via_mapping(partition_info *part_info,
part_iter->ret_null_part= part_iter->ret_null_part_orig= FALSE;
part_iter->ret_default_part= part_iter->ret_default_part_orig= FALSE;
- if (part_info->part_type == RANGE_PARTITION)
+ if (part_info->part_type == RANGE_PARTITION ||
+ part_info->part_type == VERSIONING_PARTITION)
{
if (part_info->part_charset_field_array)
get_endpoint= get_partition_id_range_for_endpoint_charset;