diff options
author | Alexey Kopytov <Alexey.Kopytov@Sun.com> | 2010-02-22 00:33:11 +0300 |
---|---|---|
committer | Alexey Kopytov <Alexey.Kopytov@Sun.com> | 2010-02-22 00:33:11 +0300 |
commit | 0afa209018fad0a0863048cebfcc8f0a52b814ee (patch) | |
tree | 94830ebea81e944773f55fcb501055d762e3db1d /sql/ha_partition.cc | |
parent | 4b85061e09ae3ec67948f9814700f69934138e99 (diff) | |
parent | 20dfd709d6454f8cdc25262c945ad203cecafc02 (diff) | |
download | mariadb-git-0afa209018fad0a0863048cebfcc8f0a52b814ee.tar.gz |
Manual merge of mysql-5.1-bugteam to mysql-trunk-merge.
Diffstat (limited to 'sql/ha_partition.cc')
-rw-r--r-- | sql/ha_partition.cc | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 04b7e9d7523..b287128471a 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -1803,13 +1803,23 @@ void ha_partition::update_create_info(HA_CREATE_INFO *create_info) void ha_partition::change_table_ptr(TABLE *table_arg, TABLE_SHARE *share) { - handler **file_array= m_file; + handler **file_array; table= table_arg; table_share= share; - do + /* + m_file can be NULL when using an old cached table in DROP TABLE, when the + table just has REMOVED PARTITIONING, see Bug#42438 + */ + if (m_file) { - (*file_array)->change_table_ptr(table_arg, share); - } while (*(++file_array)); + file_array= m_file; + DBUG_ASSERT(*file_array); + do + { + (*file_array)->change_table_ptr(table_arg, share); + } while (*(++file_array)); + } + if (m_added_file && m_added_file[0]) { /* if in middle of a drop/rename etc */ @@ -6207,7 +6217,13 @@ void ha_partition::print_error(int error, myf errflag) thd->lex->sql_command != SQLCOM_TRUNCATE) m_part_info->print_no_partition_found(table); else - m_file[m_last_part]->print_error(error, errflag); + { + /* In case m_file has not been initialized, like in bug#42438 */ + if (m_file) + m_file[m_last_part]->print_error(error, errflag); + else + handler::print_error(error, errflag); + } DBUG_VOID_RETURN; } @@ -6217,7 +6233,12 @@ bool ha_partition::get_error_message(int error, String *buf) DBUG_ENTER("ha_partition::get_error_message"); /* Should probably look for my own errors first */ - DBUG_RETURN(m_file[m_last_part]->get_error_message(error, buf)); + + /* In case m_file has not been initialized, like in bug#42438 */ + if (m_file) + DBUG_RETURN(m_file[m_last_part]->get_error_message(error, buf)); + DBUG_RETURN(handler::get_error_message(error, buf)); + } |