1--disable_warnings
2drop table if exists t1;
3--enable_warnings
4
5create table t1(n1 int, n2 int, s char(20), vs varchar(20), t text);
6insert into t1 values (1,11, 'one','eleven', 'eleven'),
7 (1,11, 'one','eleven', 'eleven'),
8 (2,11, 'two','eleven', 'eleven'),
9 (2,12, 'two','twevle', 'twelve'),
10 (2,13, 'two','thirteen', 'foo'),
11 (2,13, 'two','thirteen', 'foo'),
12 (2,13, 'two','thirteen', 'bar'),
13 (NULL,13, 'two','thirteen', 'bar'),
14 (2,NULL, 'two','thirteen', 'bar'),
15 (2,13, NULL,'thirteen', 'bar'),
16 (2,13, 'two',NULL, 'bar'),
17 (2,13, 'two','thirteen', NULL);
18
19select distinct n1 from t1;
20select count(distinct n1) from t1;
21
22select distinct n2 from t1;
23select count(distinct n2) from t1;
24
25select distinct s from t1;
26select count(distinct s) from t1;
27
28select distinct vs from t1;
29select count(distinct vs) from t1;
30
31select distinct t from t1;
32select count(distinct t) from t1;
33
34select distinct n1,n2 from t1;
35select count(distinct n1,n2) from t1;
36
37select distinct n1,s from t1;
38select count(distinct n1,s) from t1;
39
40select distinct s,n1,vs from t1;
41select count(distinct s,n1,vs) from t1;
42
43select distinct s,t from t1;
44select count(distinct s,t) from t1;
45
46select count(distinct n1), count(distinct n2) from t1;
47
48select count(distinct n2), n1 from t1 group by n1;
49drop table t1;
50
51# test the conversion from tree to MyISAM
52create table t1 (n int default NULL);
53let $1=5000;
54disable_query_log;
55while ($1)
56{
57 eval insert into t1 values($1);
58 dec $1;
59}
60enable_query_log;
61
62flush status;
63select count(distinct n) from t1;
64show status like 'Created_tmp_disk_tables';
65drop table t1;
66
67# Test use of MyISAM tmp tables
68create table t1 (s text);
69let $1=5000;
70disable_query_log;
71while ($1)
72{
73 eval insert into t1 values('$1');
74 dec $1;
75}
76enable_query_log;
77flush status;
78select count(distinct s) from t1;
79show status like 'Created_tmp_disk_tables';
80drop table t1;
81
82# End of 4.1 tests
83