1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +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

@ -1,4 +1,23 @@
#
# MDEV-14429 sql_safe_updates in my.cnf not work
#
--echo #
--echo # MDEV-14429 sql_safe_updates in my.cnf not work
--echo #
select @@sql_safe_updates;
--echo #
--echo # MDEV-18304 sql_safe_updates does not work with OR clauses
--echo #
create table t1 (a int, b int, primary key (a), key (b));
--error ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
update t1 set b=2 where a=1 or b=2;
explain update t1 set b=2 where a=1 or b=2;
--error ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
delete from t1 where a=1 or b=2;
explain delete from t1 where a=1 or b=2;
insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8);
update t1 set b=2 where a=1 or b=2;
delete from t1 where a=1 or b=2;
drop table t1;
--echo #
--echo # End of 10.3 tests
--echo #