~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
#
2
# Test of different EXPLAIN's
3
4
--disable_warnings
5
drop table if exists t1;
6
--enable_warnings
1063.9.3 by Brian Aker
Partial fix for tests for tmp
7
create TEMPORARY table t1 (id int not null, str char(10), unique(str)) ENGINE=MYISAM;
1 by brian
clean slate
8
explain select * from t1;
9
insert into t1 values (1, null),(2, null),(3, "foo"),(4, "bar");
10
select * from t1 where str is null;
11
select * from t1 where str="foo";
12
explain select * from t1 where str is null;
13
explain select * from t1 where str="foo";
14
explain select * from t1 ignore key (str) where str="foo";
15
explain select * from t1 use key (str,str) where str="foo";
16
17
#The following should give errors
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
18
--error ER_KEY_DOES_NOT_EXITS
1 by brian
clean slate
19
explain select * from t1 use key (str,str,foo) where str="foo";
1731.3.1 by Lee Bieber
change tests to use enum values instead of error numbers
20
--error ER_KEY_DOES_NOT_EXITS
1 by brian
clean slate
21
explain select * from t1 ignore key (str,str,foo) where str="foo";
22
drop table t1;
23
24
explain select 1;
25
1063.9.3 by Brian Aker
Partial fix for tests for tmp
26
create TEMPORARY table t1 (a int not null) ENGINE=myisam;
1 by brian
clean slate
27
explain select count(*) from t1;
28
insert into t1 values(1);
29
explain select count(*) from t1;
30
insert into t1 values(1);
31
explain select count(*) from t1;
32
drop table t1;
33
34
#
35
# Bug #3403 Wrong encoding in EXPLAIN SELECT output
36
#
1063.9.3 by Brian Aker
Partial fix for tests for tmp
37
create TEMPORARY table ☃ (☢ int, ☣ int, key ☢ (☢), key ☣ (☢,☣)) ENGINE=MYISAM;
712 by Brian Aker
Added back explain test.
38
insert into ☃ (☢) values (1);
39
insert into ☃ (☢) values (2);
40
explain select ☢ from ☃ where ☢=1;
41
drop table ☃;
1 by brian
clean slate
42
43
# End of 4.1 tests
44
45
46
#
47
# Bug#15463: EXPLAIN SELECT..INTO hangs the client (QB, command line)
48
#
49
select 3 into @v1;
50
explain select 3 into @v1;
51
52
#
53
# Bug #32241: memory corruption due to large index map in 'Range checked for 
54
#             each record'
55
#
56
57
CREATE TABLE t1(c INT);
58
INSERT INTO t1 VALUES (),();
59
60
CREATE TABLE t2 (b INT,
61
KEY(b),KEY(b),KEY(b),KEY(b),KEY(b),
62
KEY(b),KEY(b),KEY(b),KEY(b),KEY(b),
63
KEY(b),KEY(b),KEY(b),KEY(b),KEY(b),
64
KEY(b),KEY(b),KEY(b),KEY(b),KEY(b),
65
KEY(b),KEY(b),KEY(b),KEY(b),KEY(b),
66
KEY(b),KEY(b),KEY(b),KEY(b),KEY(b),
67
KEY(b),KEY(b),KEY(b),KEY(b),KEY(b),
68
KEY(b),KEY(b),KEY(b),KEY(b),KEY(b));
69
70
INSERT INTO t2 VALUES (),(),();
71
72
# We only need to make sure that there is no buffer overrun and the index map
73
# is displayed correctly
74
--replace_column 1 X 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X
75
EXPLAIN SELECT 1 FROM
76
  (SELECT 1 FROM t2,t1 WHERE b < c GROUP BY 1 LIMIT 1) AS d2;
77
DROP TABLE t2;
78
DROP TABLE t1;
79
80
--echo End of 5.0 tests.
81
82
--enable_metadata
83
explain select 1;
84
--disable_metadata
85
86
--echo End of 5.2 tests.