~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to tests/t/explain.test

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-03-18 12:12:31 UTC
  • Revision ID: james.westby@ubuntu.com-20100318121231-k6g1xe6cshbwa0f8
Tags: upstream-2010.03.1347
Import upstream version 2010.03.1347

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# Test of different EXPLAIN's
 
3
 
 
4
--disable_warnings
 
5
drop table if exists t1;
 
6
--enable_warnings
 
7
create TEMPORARY table t1 (id int not null, str char(10), unique(str)) ENGINE=MYISAM;
 
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 TEMPORARY table t1 (a int not null) ENGINE=myisam;
 
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
create TEMPORARY table ☃ (☢ int, ☣ int, key ☢ (☢), key ☣ (☢,☣)) ENGINE=MYISAM;
 
38
insert into ☃ (☢) values (1);
 
39
insert into ☃ (☢) values (2);
 
40
explain select ☢ from ☃ where ☢=1;
 
41
drop table ☃;
 
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.