mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Manual merge of mysql-5.1-bugteam into mysql-trunk-merge.
This commit is contained in:
@@ -947,6 +947,8 @@ int check_signed_flag(partition_info *part_info)
|
||||
table The table object
|
||||
part_info Reference to partitioning data structure
|
||||
is_sub_part Is the table subpartitioned as well
|
||||
is_create_table_ind Indicator of whether openfrm was called as part of
|
||||
CREATE or ALTER TABLE
|
||||
|
||||
RETURN VALUE
|
||||
TRUE An error occurred, something was wrong with the
|
||||
@@ -970,7 +972,7 @@ int check_signed_flag(partition_info *part_info)
|
||||
*/
|
||||
|
||||
static bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table,
|
||||
bool is_sub_part)
|
||||
bool is_sub_part, bool is_create_table_ind)
|
||||
{
|
||||
partition_info *part_info= table->part_info;
|
||||
uint dir_length, home_dir_length;
|
||||
@@ -1074,10 +1076,31 @@ static bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table,
|
||||
thd->where= save_where;
|
||||
if (unlikely(func_expr->const_item()))
|
||||
{
|
||||
my_error(ER_CONST_EXPR_IN_PARTITION_FUNC_ERROR, MYF(0));
|
||||
my_error(ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR, MYF(0));
|
||||
clear_field_flag(table);
|
||||
goto end;
|
||||
}
|
||||
|
||||
/*
|
||||
We don't allow creating partitions with timezone-dependent expressions as
|
||||
a (sub)partitioning function, but we want to allow such expressions when
|
||||
opening existing tables for easier maintenance. This exception should be
|
||||
deprecated at some point in future so that we always throw an error.
|
||||
*/
|
||||
if (func_expr->walk(&Item::is_timezone_dependent_processor,
|
||||
0, NULL))
|
||||
{
|
||||
if (is_create_table_ind)
|
||||
{
|
||||
my_error(ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR, MYF(0));
|
||||
goto end;
|
||||
}
|
||||
else
|
||||
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR,
|
||||
ER(ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR));
|
||||
}
|
||||
|
||||
if ((!is_sub_part) && (error= check_signed_flag(part_info)))
|
||||
goto end;
|
||||
result= set_up_field_array(table, is_sub_part);
|
||||
@@ -1685,7 +1708,7 @@ bool fix_partition_func(THD *thd, TABLE *table,
|
||||
else
|
||||
{
|
||||
if (unlikely(fix_fields_part_func(thd, part_info->subpart_expr,
|
||||
table, TRUE)))
|
||||
table, TRUE, is_create_table_ind)))
|
||||
goto end;
|
||||
if (unlikely(part_info->subpart_expr->result_type() != INT_RESULT))
|
||||
{
|
||||
@@ -1713,7 +1736,7 @@ bool fix_partition_func(THD *thd, TABLE *table,
|
||||
else
|
||||
{
|
||||
if (unlikely(fix_fields_part_func(thd, part_info->part_expr,
|
||||
table, FALSE)))
|
||||
table, FALSE, is_create_table_ind)))
|
||||
goto end;
|
||||
if (unlikely(part_info->part_expr->result_type() != INT_RESULT))
|
||||
{
|
||||
@@ -1736,7 +1759,7 @@ bool fix_partition_func(THD *thd, TABLE *table,
|
||||
else
|
||||
{
|
||||
if (unlikely(fix_fields_part_func(thd, part_info->part_expr,
|
||||
table, FALSE)))
|
||||
table, FALSE, is_create_table_ind)))
|
||||
goto end;
|
||||
}
|
||||
part_info->fixed= TRUE;
|
||||
|
Reference in New Issue
Block a user