mariadb/mysql-test/main/sql_safe_updates.test
Monty c443dbff0e Ensure that test_quick_select doesn't return more rows than in the table
Other changes:
- In test_quick_select(), assume that if table->used_stats_records is 0
  then the table has 0 rows.
- Fixed prepare_simple_select() to populate table->used_stat_records
- Enusre that set_statistics_for_tables() doesn't cause used_stats_records
  to be 0 when using stat_tables.
- To get blackhole to work with replication, set stats.records to 2 so
  that test_quick_select() doesn't assume the table is empty.
2023-01-30 15:22:20 +02:00

26 lines
808 B
Text

--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));
update t1 set b=2 where a=1 or b=2;
explain update t1 set b=2 where a=1 or b=2;
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);
explain update t1 set b=2 where a=1 or b=2;
update t1 set b=2 where a=1 or b=2;
set @@optimizer_switch="index_merge=off";
--error ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
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;
drop table t1;
--echo #
--echo # End of 10.3 tests
--echo #