summaryrefslogtreecommitdiff
path: root/sql/sql_partition.cc
diff options
context:
space:
mode:
authorMattias Jonsson <mattias.jonsson@oracle.com>2010-08-30 17:33:55 +0200
committerMattias Jonsson <mattias.jonsson@oracle.com>2010-08-30 17:33:55 +0200
commite7dc80b8078d2f63bd1d12f0d61f13c88e96f87f (patch)
tree95c1677d57c85cadeb341aee06221cfbe98753ec /sql/sql_partition.cc
parent622250cba7fb85321814187a84732cbeb2c40088 (diff)
downloadmariadb-git-e7dc80b8078d2f63bd1d12f0d61f13c88e96f87f.tar.gz
Bug#50036: Inconsistent errors when using TIMESTAMP columns/expressions
It was hard to understand what the error really meant. The error checking in partitioning is done in several different parts during the execution of a query which can make it hard to return useful errors. Added a new error for bad VALUES part in the per PARTITION clause. Using the more verbose error that a column is not allowed in the partitioning function instead of just that the function is not allowed.
Diffstat (limited to 'sql/sql_partition.cc')
-rw-r--r--sql/sql_partition.cc18
1 files changed, 10 insertions, 8 deletions
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index b72816f8ce3..d95ba3fa71e 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -1762,8 +1762,7 @@ bool fix_partition_func(THD *thd, TABLE *table,
goto end;
if (unlikely(part_info->subpart_expr->result_type() != INT_RESULT))
{
- my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0),
- subpart_str);
+ part_info->report_part_expr_error(TRUE);
goto end;
}
}
@@ -1790,10 +1789,9 @@ bool fix_partition_func(THD *thd, TABLE *table,
goto end;
if (unlikely(part_info->part_expr->result_type() != INT_RESULT))
{
- my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0), part_str);
+ part_info->report_part_expr_error(FALSE);
goto end;
}
- part_info->part_result_type= INT_RESULT;
}
part_info->fixed= TRUE;
}
@@ -1839,18 +1837,22 @@ bool fix_partition_func(THD *thd, TABLE *table,
if (unlikely(!part_info->column_list &&
part_info->part_expr->result_type() != INT_RESULT))
{
- my_error(ER_PARTITION_FUNC_NOT_ALLOWED_ERROR, MYF(0), part_str);
+ part_info->report_part_expr_error(FALSE);
goto end;
}
}
if (((part_info->part_type != HASH_PARTITION ||
- part_info->list_of_part_fields == FALSE) &&
- (!part_info->column_list &&
- check_part_func_fields(part_info->part_field_array, TRUE))) ||
+ part_info->list_of_part_fields == FALSE) &&
+ !part_info->column_list &&
+ check_part_func_fields(part_info->part_field_array, TRUE)) ||
(part_info->list_of_subpart_fields == FALSE &&
part_info->is_sub_partitioned() &&
check_part_func_fields(part_info->subpart_field_array, TRUE)))
{
+ /*
+ Range/List/HASH (but not KEY) and not COLUMNS or HASH subpartitioning
+ with columns in the partitioning expression using unallowed charset.
+ */
my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0));
goto end;
}