diff options
| author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-09-24 08:42:23 +0300 |
|---|---|---|
| committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-09-24 08:42:23 +0300 |
| commit | 7e2b42324caf6faaaa5a3a033c2b24e1fee93669 (patch) | |
| tree | 282e59399ddb9e3f72f2607deb163e580f06a88f /sql/sql_update.cc | |
| parent | f5794e1dc6e3d27405daeae850b8e69fd631b62d (diff) | |
| parent | 913efaa328026455cef0e608c25eaed042344b15 (diff) | |
| download | mariadb-git-7e2b42324caf6faaaa5a3a033c2b24e1fee93669.tar.gz | |
Merge 10.4 into 10.5
Diffstat (limited to 'sql/sql_update.cc')
| -rw-r--r-- | sql/sql_update.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 977e459f9df..624c183c83b 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -754,15 +754,20 @@ int mysql_update(THD *thd, !table->check_virtual_columns_marked_for_write()) { DBUG_PRINT("info", ("Trying direct update")); - if (select && select->cond && - (select->cond->used_tables() == table->map)) + bool use_direct_update= !select || !select->cond; + if (!use_direct_update && + (select->cond->used_tables() & ~RAND_TABLE_BIT) == table->map) { DBUG_ASSERT(!table->file->pushed_cond); if (!table->file->cond_push(select->cond)) + { + use_direct_update= TRUE; table->file->pushed_cond= select->cond; + } } - if (!table->file->info_push(INFO_KIND_UPDATE_FIELDS, &fields) && + if (use_direct_update && + !table->file->info_push(INFO_KIND_UPDATE_FIELDS, &fields) && !table->file->info_push(INFO_KIND_UPDATE_VALUES, &values) && !table->file->direct_update_rows_init(&fields)) { |
