~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/count_distinct2.test

  • Committer: Brian Aker
  • Date: 2008-09-12 06:42:41 UTC
  • mto: (322.2.8 stdize-code)
  • mto: This revision was merged to the branch mainline in revision 386.
  • Revision ID: brian@tangent.org-20080912064241-520utxq2078904l2
Remove 3 byte UTF8 collation

Show diffs side-by-side

added added

removed removed

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