summaryrefslogtreecommitdiff
path: root/mysql-test/t/select_safe.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/select_safe.test')
-rw-r--r--mysql-test/t/select_safe.test36
1 files changed, 29 insertions, 7 deletions
diff --git a/mysql-test/t/select_safe.test b/mysql-test/t/select_safe.test
index cd8bce6369c..be25c7c05d1 100644
--- a/mysql-test/t/select_safe.test
+++ b/mysql-test/t/select_safe.test
@@ -7,7 +7,7 @@ drop table if exists t1;
--enable_warnings
SET SQL_SAFE_UPDATES=1,SQL_SELECT_LIMIT=4, SQL_MAX_JOIN_SIZE=9;
-create table t1 (a int primary key, b char(20));
+create table t1 (a int auto_increment 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;
@@ -18,18 +18,40 @@ 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;
+--error 1175
+update t1 set b="a";
+--error 1175
+update t1 set b="a" where b="test";
+--error 1175
+delete from t1;
+--error 1175
+delete from t1 where b="test";
+--error 1175
+delete from t1 where a+0=1;
+--error 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;
+
+# Test SQL_BIG_SELECTS
+
+SET MAX_JOIN_SIZE=2;
+SELECT @@MAX_JOIN_SIZE, @@SQL_BIG_SELECTS;
+insert into t1 values (null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a");
+--error 1104
+SELECT * from t1;
+SET SQL_BIG_SELECTS=1;
+SELECT * from t1;
+SET MAX_JOIN_SIZE=2;
+--error 1104
+SELECT * from t1;
+SET MAX_JOIN_SIZE=DEFAULT;
+SELECT * from t1;
+
drop table t1;
SET SQL_SAFE_UPDATES=0,SQL_SELECT_LIMIT=DEFAULT, SQL_MAX_JOIN_SIZE=DEFAULT;