diff options
author | Michael Widenius <monty@askmonty.org> | 2011-02-28 19:39:30 +0200 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2011-02-28 19:39:30 +0200 |
commit | 11ed10cbe2c7c4b83aca4153856e76f4bdc484dd (patch) | |
tree | da0e622896425203d23ecdfd1bc77b57e3502edf /sql/sql_partition.cc | |
parent | dfcc0010cf7be502bfca31aff75ba830f6962264 (diff) | |
parent | 670f2f62c48741ea72440a1574dc99bae9390131 (diff) | |
download | mariadb-git-11ed10cbe2c7c4b83aca4153856e76f4bdc484dd.tar.gz |
Merge with 5.1 to get in changes from MySQL 5.1.55
Diffstat (limited to 'sql/sql_partition.cc')
-rw-r--r-- | sql/sql_partition.cc | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 851bd6b875b..1c78f6a3613 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -1015,12 +1015,13 @@ static bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table, } /* - 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. + We don't allow creating partitions with expressions with non matching + arguments 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, + if (func_expr->walk(&Item::check_valid_arguments_processor, 0, NULL)) { if (is_create_table_ind) @@ -1983,6 +1984,9 @@ static int add_partition_options(File fptr, partition_element *p_elem) } if (p_elem->part_comment) err+= add_keyword_string(fptr, "COMMENT", TRUE, p_elem->part_comment); + if (p_elem->connect_string.length) + err+= add_keyword_string(fptr, "CONNECTION", TRUE, + p_elem->connect_string.str); return err + add_engine(fptr,p_elem->engine_type); } @@ -5936,6 +5940,12 @@ static void alter_partition_lock_handling(ALTER_PARTITION_PARAM_TYPE *lpt) if (lpt->thd->locked_tables) { /* + Close the table if open, to remove/destroy the already altered + table->part_info object, so that it is not reused. + */ + if (lpt->table->db_stat) + abort_and_upgrade_lock_and_close_table(lpt); + /* When we have the table locked, it is necessary to reopen the table since all table objects were closed and removed as part of the ALTER TABLE of partitioning structure. @@ -6437,7 +6447,20 @@ uint fast_alter_partition_table(THD *thd, TABLE *table, table, table_list, FALSE, NULL, written_bin_log)); err: - close_thread_tables(thd); + if (thd->locked_tables) + { + /* + table->part_info was altered in prep_alter_part_table and must be + destroyed and recreated, since otherwise it will be reused, since + we are under LOCK TABLE. + */ + alter_partition_lock_handling(lpt); + } + else + { + /* Force the table to be closed to avoid reuse of the table->part_info */ + close_thread_tables(thd); + } DBUG_RETURN(TRUE); } #endif @@ -6748,8 +6771,8 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info, { DBUG_ASSERT(!is_subpart); Field *field= part_info->part_field_array[0]; - uint32 max_endpoint_val; - get_endpoint_func get_endpoint; + uint32 UNINIT_VAR(max_endpoint_val); + get_endpoint_func UNINIT_VAR(get_endpoint); bool can_match_multiple_values; /* is not '=' */ uint field_len= field->pack_length_in_rec(); part_iter->ret_null_part= part_iter->ret_null_part_orig= FALSE; |