1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +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

@ -371,7 +371,8 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
DBUG_RETURN(TRUE);
const_cond= (!conds || conds->const_item());
safe_update= MY_TEST(thd->variables.option_bits & OPTION_SAFE_UPDATES);
safe_update= (thd->variables.option_bits & OPTION_SAFE_UPDATES) &&
!thd->lex->describe;
if (safe_update && const_cond)
{
my_message(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE,
@ -497,7 +498,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
}
/* 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)