summaryrefslogtreecommitdiff
path: root/sql/sql_partition.cc
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2019-08-28 11:57:16 +0300
committerAleksey Midenkov <midenok@gmail.com>2019-09-01 14:04:25 +0300
commitc3f35ea55a7150b186284e2ef717d12e6f81e13e (patch)
tree3ad2bd5855280e9b58f95d5e58cc50318ea19cfd /sql/sql_partition.cc
parenta3e49c0d36c0347e9dee43f9996ca7c407836a51 (diff)
downloadmariadb-git-c3f35ea55a7150b186284e2ef717d12e6f81e13e.tar.gz
MDEV-18501 Partition pruning doesn't work for historical queries (refactoring)
SYSTEM_TYPE partitioning: COLUMN properties removed. Partitioning is now pure RANGE based on UNIX_TIMESTAMP(row_end). DECIMAL type is now allowed as RANGE partitioning, we can partition by UNIX_TIMESTAMP() (but not for DATETIME which depends on local timezone of course).
Diffstat (limited to 'sql/sql_partition.cc')
-rw-r--r--sql/sql_partition.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 34f8a4e3aee..ba6d0f14aeb 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -1975,7 +1975,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.
@@ -2008,15 +2007,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;
@@ -2032,7 +2031,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;
@@ -2541,7 +2541,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"));
@@ -5321,7 +5321,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;
@@ -5417,7 +5417,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;