diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/handler.cc | 13 | ||||
-rw-r--r-- | sql/handler.h | 2 | ||||
-rw-r--r-- | sql/unireg.cc | 3 |
3 files changed, 12 insertions, 6 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index 7eed722a971..fcba43fd492 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -3997,7 +3997,8 @@ void handler::mark_trx_read_write_internal() DBUG_ASSERT(has_transactions()); /* table_share can be NULL in ha_delete_table(). See implementation - of standalone function ha_delete_table() in sql_base.cc. + of standalone function ha_delete_table() in sql_base.cc. It can + also be NULL during table creation. */ if (table_share == NULL || table_share->tmp_table == NO_TMP_TABLE) ha_info->set_trx_read_write(); @@ -4383,7 +4384,8 @@ handler::ha_create(const char *name, TABLE *form, HA_CREATE_INFO *info_arg) int handler::ha_create_partitioning_metadata(const char *name, const char *old_name, - int action_flag) + int action_flag, + bool should_mark_rw) { /* Normally this is done when unlocked, but in fast_alter_partition_table, @@ -4391,8 +4393,11 @@ handler::ha_create_partitioning_metadata(const char *name, partitions. */ DBUG_ASSERT(m_lock_type == F_UNLCK || - (!old_name && strcmp(name, table_share->path.str))); - mark_trx_read_write(); + (!old_name && table_share && strcmp(name, table_share->path.str))); + if (should_mark_rw) + { + mark_trx_read_write(); + } return create_partitioning_metadata(name, old_name, action_flag); } diff --git a/sql/handler.h b/sql/handler.h index b280f6d597d..6c35e5eafc0 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -2923,7 +2923,7 @@ public: int ha_create(const char *name, TABLE *form, HA_CREATE_INFO *info); int ha_create_partitioning_metadata(const char *name, const char *old_name, - int action_flag); + int action_flag, bool should_mark_rw = true); int ha_change_partitions(HA_CREATE_INFO *create_info, const char *path, diff --git a/sql/unireg.cc b/sql/unireg.cc index 899b612bd89..c01f4ac8ffe 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -411,7 +411,8 @@ int rea_create_table(THD *thd, LEX_CUSTRING *frm, if (thd->variables.keep_files_on_create) create_info->options|= HA_CREATE_KEEP_FILES; - if (file->ha_create_partitioning_metadata(path, NULL, CHF_CREATE_FLAG)) + if (file->ha_create_partitioning_metadata(path, NULL, + CHF_CREATE_FLAG, !create_info->tmp_table())) goto err_part; if (!no_ha_create_table) |