diff options
Diffstat (limited to 'sql/table.cc')
-rw-r--r-- | sql/table.cc | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/sql/table.cc b/sql/table.cc index 2143faaff5c..cacb3a94582 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1793,13 +1793,18 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, outparam, is_create_table, share->default_part_db_type, &work_part_info_used); - if (!tmp) - outparam->part_info->is_auto_partitioned= share->auto_partitioned; + if (tmp) + { + thd->stmt_arena= backup_stmt_arena_ptr; + thd->restore_active_arena(&part_func_arena, &backup_arena); + goto partititon_err; + } + outparam->part_info->is_auto_partitioned= share->auto_partitioned; DBUG_PRINT("info", ("autopartitioned: %u", share->auto_partitioned)); /* we should perform the fix_partition_func in either local or caller's arena depending on work_part_info_used value */ - if (!tmp && !work_part_info_used) + if (!work_part_info_used) tmp= fix_partition_func(thd, outparam, is_create_table); thd->stmt_arena= backup_stmt_arena_ptr; thd->restore_active_arena(&part_func_arena, &backup_arena); @@ -1809,6 +1814,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, tmp= fix_partition_func(thd, outparam, is_create_table); outparam->part_info->item_free_list= part_func_arena.free_list; } +partititon_err: if (tmp) { if (is_create_table) @@ -3275,31 +3281,32 @@ bool TABLE_LIST::prep_check_option(THD *thd, uint8 check_opt_type) } -/* +/** Hide errors which show view underlying table information - SYNOPSIS - TABLE_LIST::hide_view_error() - thd thread handler + @param[in,out] thd thread handler + @pre This method can be called only if there is an error. */ void TABLE_LIST::hide_view_error(THD *thd) { /* Hide "Unknown column" or "Unknown function" error */ - if (thd->net.last_errno == ER_BAD_FIELD_ERROR || - thd->net.last_errno == ER_SP_DOES_NOT_EXIST || - thd->net.last_errno == ER_PROCACCESS_DENIED_ERROR || - thd->net.last_errno == ER_COLUMNACCESS_DENIED_ERROR || - thd->net.last_errno == ER_TABLEACCESS_DENIED_ERROR || - thd->net.last_errno == ER_TABLE_NOT_LOCKED || - thd->net.last_errno == ER_NO_SUCH_TABLE) + DBUG_ASSERT(thd->is_error()); + + if (thd->main_da.sql_errno() == ER_BAD_FIELD_ERROR || + thd->main_da.sql_errno() == ER_SP_DOES_NOT_EXIST || + thd->main_da.sql_errno() == ER_PROCACCESS_DENIED_ERROR || + thd->main_da.sql_errno() == ER_COLUMNACCESS_DENIED_ERROR || + thd->main_da.sql_errno() == ER_TABLEACCESS_DENIED_ERROR || + thd->main_da.sql_errno() == ER_TABLE_NOT_LOCKED || + thd->main_da.sql_errno() == ER_NO_SUCH_TABLE) { TABLE_LIST *top= top_table(); - thd->clear_error(); + thd->clear_error(); my_error(ER_VIEW_INVALID, MYF(0), top->view_db.str, top->view_name.str); } - else if (thd->net.last_errno == ER_NO_DEFAULT_FOR_FIELD) + else if (thd->main_da.sql_errno() == ER_NO_DEFAULT_FOR_FIELD) { TABLE_LIST *top= top_table(); thd->clear_error(); |