summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 9279e2eccde..8b987914697 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1950,8 +1950,9 @@ bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx)
DBUG_PRINT("info",("Using locked table"));
#ifdef WITH_PARTITION_STORAGE_ENGINE
part_names_error= set_partitions_as_used(table_list, table);
- if (!part_names_error
- && table->vers_switch_partition(thd, table_list, ot_ctx))
+ if (!part_names_error &&
+ table_list->lock_type >= TL_WRITE_ALLOW_WRITE &&
+ table->vers_switch_partition(thd, table_list, ot_ctx))
DBUG_RETURN(true);
#endif
goto reset;
@@ -2212,6 +2213,7 @@ retry_share:
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (!part_names_error &&
+ table_list->lock_type >= TL_WRITE_ALLOW_WRITE &&
table->vers_switch_partition(thd, table_list, ot_ctx))
{
MYSQL_UNBIND_TABLE(table->file);
@@ -3152,7 +3154,7 @@ ret:
static bool open_table_entry_fini(THD *thd, TABLE_SHARE *share, TABLE *entry)
{
if (Table_triggers_list::check_n_load(thd, &share->db,
- &share->table_name, entry, 0))
+ &share->table_name, entry, false, 0))
return TRUE;
/*