~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
7
create table t1 (id int not null, str char(10), unique(str));
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
18
--error 1176
19
explain select * from t1 use key (str,str,foo) where str="foo";
20
--error 1176
21
explain select * from t1 ignore key (str,str,foo) where str="foo";
22
drop table t1;
23
24
explain select 1;
25
26
create table t1 (a int not null);
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
#
37
set names koi8r;
38
create table ÔÁÂ (ËÏÌ0 int, ËÏÌ1 int, key ÉÎÄ0 (ËÏÌ0), key ÉÎÄ01 (ËÏÌ0,ËÏÌ1));
39
insert into ÔÁÂ (ËÏÌ0) values (1);
40
insert into ÔÁÂ (ËÏÌ0) values (2);
41
explain select ËÏÌ0 from ÔÁÂ where ËÏÌ0=1;
42
drop table ÔÁÂ;
43
set names latin1;
44
45
# End of 4.1 tests
46
47
48
#
49
# Bug#15463: EXPLAIN SELECT..INTO hangs the client (QB, command line)
50
#
51
select 3 into @v1;
52
explain select 3 into @v1;
53
54
#
55
# Bug #32241: memory corruption due to large index map in 'Range checked for 
56
#             each record'
57
#
58
59
CREATE TABLE t1(c INT);
60
INSERT INTO t1 VALUES (),();
61
62
CREATE TABLE t2 (b INT,
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
KEY(b),KEY(b),KEY(b),KEY(b),KEY(b),
70
KEY(b),KEY(b),KEY(b),KEY(b),KEY(b));
71
72
INSERT INTO t2 VALUES (),(),();
73
74
# We only need to make sure that there is no buffer overrun and the index map
75
# is displayed correctly
76
--replace_column 1 X 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X
77
EXPLAIN SELECT 1 FROM
78
  (SELECT 1 FROM t2,t1 WHERE b < c GROUP BY 1 LIMIT 1) AS d2;
79
DROP TABLE t2;
80
DROP TABLE t1;
81
82
--echo End of 5.0 tests.
83
84
--enable_metadata
85
explain select 1;
86
--disable_metadata
87
88
--echo End of 5.2 tests.