1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

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.
This commit is contained in:
Sergei Golubchik
2021-10-12 18:34:51 +02:00
parent dc680d2119
commit 6789f2cfab
4 changed files with 52 additions and 7 deletions

View File

@ -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)