mariadb/mysql-test/t/select_safe.test
monty@donna.mysql.com c0f40d14cc Added support for hex strings to mysqlimport
A lot of new tests to mysqltest
Fixed bug with BDB tables and autocommit
2000-12-28 03:56:38 +02:00

32 lines
983 B
Text

#
# test of safe selects
#
drop table if exists t1;
SET SQL_SAFE_UPDATES=1,SQL_SELECT_LIMIT=4, SQL_MAX_JOIN_SIZE=9;
create table t1 (a int primary key, b char(20));
insert into t1 values(1,"test");
SELECT SQL_BUFFER_RESULT * from t1;
update t1 set b="a" where a=1;
delete from t1 where a=1;
insert into t1 values(1,"test"),(2,"test2");
SELECT SQL_BUFFER_RESULT * from t1;
update t1 set b="a" where a=1;
select 1 from t1,t1 as t2,t1 as t3,t1 as t4;
# The following should give errors:
!$1175 update t1 set b="a";
!$1175 update t1 set b="a" where b="test";
!$1175 delete from t1;
!$1175 delete from t1 where b="test";
!$1175 delete from t1 where a+0=1;
!$1104 select 1 from t1,t1 as t2,t1 as t3,t1 as t4,t1 as t5;
# The following should be ok:
update t1 set b="a" limit 1;
update t1 set b="a" where b="b" limit 2;
delete from t1 where b="test" limit 1;
delete from t1 where a+0=1 limit 2;
drop table t1;
SET SQL_SAFE_UPDATES=0,SQL_SELECT_LIMIT=DEFAULT, SQL_MAX_JOIN_SIZE=DEFAULT;