summaryrefslogtreecommitdiff
path: root/sql/sql_update.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2021-10-12 18:34:51 +0200
committerSergei Golubchik <serg@mariadb.org>2022-03-12 19:13:17 +0100
commit6789f2cfabb6a92b17ce822921cb522098ef3ff7 (patch)
tree104a4ebfb3a2bb6665614c4eb8e64ffc4a25e8ca /sql/sql_update.cc
parentdc680d2119d3cc4ad642e5c1f11f38ab072b3032 (diff)
downloadmariadb-git-6789f2cfabb6a92b17ce822921cb522098ef3ff7.tar.gz
MDEV-18304 sql_safe_updates does not work with OR clauses
not every index-using plan sets bits in table->quick_keys. QUICK_ROR_INTERSECT_SELECT, for example, doesn't. Use the fact that select->quick is set instead. Also allow EXPLAIN to work.
Diffstat (limited to 'sql/sql_update.cc')
-rw-r--r--sql/sql_update.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 6065d03402f..1e997b75c7d 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -314,7 +314,8 @@ int mysql_update(THD *thd,
ha_rows *found_return, ha_rows *updated_return)
{
bool using_limit= limit != HA_POS_ERROR;
- bool safe_update= thd->variables.option_bits & OPTION_SAFE_UPDATES;
+ bool safe_update= (thd->variables.option_bits & OPTION_SAFE_UPDATES)
+ && !thd->lex->describe;
bool used_key_is_modified= FALSE, transactional_table;
bool will_batch= FALSE;
bool can_compare_record;
@@ -517,7 +518,7 @@ int mysql_update(THD *thd,
}
/* If running in safe sql mode, don't allow updates without keys */
- if (table->quick_keys.is_clear_all())
+ if (!select || !select->quick)
{
thd->set_status_no_index_used();
if (safe_update && !using_limit)