summaryrefslogtreecommitdiff
path: root/sql/sql_update.cc
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2019-12-02 12:51:53 +0300
committerAleksey Midenkov <midenok@gmail.com>2019-12-02 12:51:53 +0300
commit0b8b11b0b15f2d3d20dc801e50fa2beedc080dad (patch)
tree7a7b9f8ec419bff57b3b0258293d91f180908037 /sql/sql_update.cc
parent1d46923a0f6508d52d7ce679a7dd8e7e0e957ae4 (diff)
parentdb32d9457edbcb23b45f433cfcdfc5d86232bbb0 (diff)
downloadmariadb-git-0b8b11b0b15f2d3d20dc801e50fa2beedc080dad.tar.gz
Merge 10.3 into 10.4
Diffstat (limited to 'sql/sql_update.cc')
-rw-r--r--sql/sql_update.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 68b402dc925..8ecac25e162 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -206,10 +206,10 @@ static bool check_fields(THD *thd, TABLE_LIST *table, List<Item> &items,
return FALSE;
}
-static bool check_has_vers_fields(TABLE *table, List<Item> &items)
+bool TABLE::vers_check_update(List<Item> &items)
{
List_iterator<Item> it(items);
- if (!table->versioned())
+ if (!versioned_write())
return false;
while (Item *item= it++)
@@ -217,8 +217,11 @@ static bool check_has_vers_fields(TABLE *table, List<Item> &items)
if (Item_field *item_field= item->field_for_view_update())
{
Field *field= item_field->field;
- if (field->table == table && !field->vers_update_unversioned())
+ if (field->table == this && !field->vers_update_unversioned())
+ {
+ no_cache= true;
return true;
+ }
}
}
return false;
@@ -481,7 +484,7 @@ int mysql_update(THD *thd,
{
DBUG_RETURN(1);
}
- bool has_vers_fields= check_has_vers_fields(table, fields);
+ bool has_vers_fields= table->vers_check_update(fields);
if (check_key_in_view(thd, table_list))
{
my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias.str, "UPDATE");
@@ -2254,7 +2257,7 @@ multi_update::initialize_tables(JOIN *join)
if (safe_update_on_fly(thd, join->join_tab, table_ref, all_tables))
{
table_to_update= table; // Update table on the fly
- has_vers_fields= check_has_vers_fields(table, *fields);
+ has_vers_fields= table->vers_check_update(*fields);
continue;
}
}
@@ -2723,7 +2726,7 @@ int multi_update::do_updates()
if (table->vfield)
empty_record(table);
- has_vers_fields= check_has_vers_fields(table, *fields);
+ has_vers_fields= table->vers_check_update(*fields);
check_opt_it.rewind();
while(TABLE *tbl= check_opt_it++)