~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
#
2
# test of safe selects
3
#
4
5
--disable_warnings
6
drop table if exists t1;
7
--enable_warnings
8
1237.6.1 by Brian Aker
Remove dead bits in parser/whitespace/etc.
9
SET SQL_SELECT_LIMIT=4, MAX_JOIN_SIZE=9;
1 by brian
clean slate
10
create table t1 (a int auto_increment primary key, b char(20));
11
insert into t1 values(1,"test");
12
SELECT SQL_BUFFER_RESULT * from t1;
13
update t1 set b="a" where a=1;
14
delete from t1 where a=1;
15
insert into t1 values(1,"test"),(2,"test2");
16
SELECT SQL_BUFFER_RESULT * from t1;
17
update t1 set b="a" where a=1;
18
select 1 from t1,t1 as t2,t1 as t3;
19
1237.6.1 by Brian Aker
Remove dead bits in parser/whitespace/etc.
20
# The following should NOT give errors:
1 by brian
clean slate
21
update t1 set b="a";
22
update t1 set b="a" where b="test";
23
delete from t1;
24
delete from t1 where b="test";
25
delete from t1 where a+0=1;
26
select 1 from t1,t1 as t2,t1 as t3,t1 as t4,t1 as t5;
27
28
# The following should be ok:
29
update t1 set b="a" limit 1;
30
update t1 set b="a" where b="b" limit 2; 
31
delete from t1 where b="test" limit 1;
32
delete from t1 where a+0=1 limit 2;
33
34
# Test SQL_BIG_SELECTS
35
36
alter table t1 add key b (b);
37
SET MAX_JOIN_SIZE=2;
38
SELECT @@MAX_JOIN_SIZE, @@SQL_BIG_SELECTS;
39
insert into t1 values (null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a");
40
--error 1104
41
SELECT * from t1 order by a;
42
SET SQL_BIG_SELECTS=1;
43
SELECT * from t1 order by a;
44
SET MAX_JOIN_SIZE=2;
45
--error 1104
46
SELECT * from t1;
47
SET MAX_JOIN_SIZE=DEFAULT;
48
SELECT * from t1;
49
50
#
51
# Test MAX_SEEKS_FOR_KEY
52
#
53
analyze table t1;
54
insert into t1 values (null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a");
55
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
56
set MAX_SEEKS_FOR_KEY=1;
57
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
58
SET MAX_SEEKS_FOR_KEY=DEFAULT;
59
60
drop table t1;
61
62
# BUG#8726
63
create table t1 (a int);
64
insert into t1 values (1),(2),(3),(4),(5);
65
insert into t1 select * from t1;
66
insert into t1 select * from t1;
67
insert into t1 select * from t1;
68
69
set local  max_join_size=8;
70
--error 1104
71
select * from (select * from t1) x;
72
73
set local  max_join_size=1;
74
--error 1104
75
select * from (select a.a as aa, b.a as ba from t1 a, t1 b) x;
76
77
set local  max_join_size=1;
78
--error 1104
79
select * from (select 1 union select 2 union select 3) x;
80
drop table t1;
81
1237.6.1 by Brian Aker
Remove dead bits in parser/whitespace/etc.
82
SET SQL_SELECT_LIMIT=DEFAULT, MAX_JOIN_SIZE=DEFAULT;
1 by brian
clean slate
83
84
# End of 4.1 tests