~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");
1441 by Brian Aker
Fixing tests to work with PBXT.
12
--sorted_result
1 by brian
clean slate
13
SELECT SQL_BUFFER_RESULT * from t1;
14
update t1 set b="a" where a=1;
15
delete from t1 where a=1;
16
insert into t1 values(1,"test"),(2,"test2");
1441 by Brian Aker
Fixing tests to work with PBXT.
17
--sorted_result
1 by brian
clean slate
18
SELECT SQL_BUFFER_RESULT * from t1;
19
update t1 set b="a" where a=1;
2141.4.2 by Andrew Hutchings
Implicit joins of the form "SELECT * FROM t1, t2" without WHERE or ON now error.
20
select 1 from t1 CROSS JOIN t1 as t2 CROSS JOIN t1 as t3;
1 by brian
clean slate
21
1237.6.1 by Brian Aker
Remove dead bits in parser/whitespace/etc.
22
# The following should NOT give errors:
1 by brian
clean slate
23
update t1 set b="a";
24
update t1 set b="a" where b="test";
25
delete from t1;
26
delete from t1 where b="test";
27
delete from t1 where a+0=1;
2141.4.2 by Andrew Hutchings
Implicit joins of the form "SELECT * FROM t1, t2" without WHERE or ON now error.
28
select 1 from t1 CROSS JOIN t1 as t2 CROSS JOIN t1 as t3 CROSS JOIN t1 as t4 CROSS JOIN t1 as t5;
1 by brian
clean slate
29
30
# The following should be ok:
31
update t1 set b="a" limit 1;
32
update t1 set b="a" where b="b" limit 2; 
33
delete from t1 where b="test" limit 1;
34
delete from t1 where a+0=1 limit 2;
35
36
# Test SQL_BIG_SELECTS
37
38
alter table t1 add key b (b);
39
SET MAX_JOIN_SIZE=2;
40
SELECT @@MAX_JOIN_SIZE, @@SQL_BIG_SELECTS;
41
insert into t1 values (null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a");
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
42
--error ER_TOO_BIG_SELECT
1 by brian
clean slate
43
SELECT * from t1 order by a;
44
SET SQL_BIG_SELECTS=1;
45
SELECT * from t1 order by a;
46
SET MAX_JOIN_SIZE=2;
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
47
--error ER_TOO_BIG_SELECT
1 by brian
clean slate
48
SELECT * from t1;
49
SET MAX_JOIN_SIZE=DEFAULT;
50
SELECT * from t1;
51
52
#
53
# Test MAX_SEEKS_FOR_KEY
54
#
55
analyze table t1;
56
insert into t1 values (null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a");
57
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
58
set MAX_SEEKS_FOR_KEY=1;
59
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
60
SET MAX_SEEKS_FOR_KEY=DEFAULT;
61
62
drop table t1;
63
64
# BUG#8726
65
create table t1 (a int);
66
insert into t1 values (1),(2),(3),(4),(5);
67
insert into t1 select * from t1;
68
insert into t1 select * from t1;
69
insert into t1 select * from t1;
70
71
set local  max_join_size=8;
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
72
--error ER_TOO_BIG_SELECT
1 by brian
clean slate
73
select * from (select * from t1) x;
74
75
set local  max_join_size=1;
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
76
--error ER_TOO_BIG_SELECT
1 by brian
clean slate
77
select * from (select a.a as aa, b.a as ba from t1 a, t1 b) x;
78
79
set local  max_join_size=1;
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
80
--error ER_TOO_BIG_SELECT
1 by brian
clean slate
81
select * from (select 1 union select 2 union select 3) x;
82
drop table t1;
83
1237.6.1 by Brian Aker
Remove dead bits in parser/whitespace/etc.
84
SET SQL_SELECT_LIMIT=DEFAULT, MAX_JOIN_SIZE=DEFAULT;
1 by brian
clean slate
85
86
# End of 4.1 tests