~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to mysql-test/t/group_min_max_innodb.test

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# Test file for WL#1724 (Min/Max Optimization for Queries with Group By Clause).
 
3
# The queries in this file test query execution via QUICK_GROUP_MIN_MAX_SELECT
 
4
# that depends on InnoDB
 
5
#
 
6
 
 
7
--source include/have_innodb.inc
 
8
 
 
9
--disable_warnings
 
10
drop view if exists v1;
 
11
drop table if exists t1,t4;
 
12
--enable_warnings
 
13
 
 
14
#
 
15
# Bug #12672: primary key implcitly included in every innodb index
 
16
#
 
17
 
 
18
--disable_warnings
 
19
create table t4 (
 
20
  pk_col int auto_increment primary key, a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
 
21
) engine=innodb;
 
22
--enable_warnings
 
23
 
 
24
insert into t4 (a1, a2, b, c, d) values
 
25
('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
 
26
('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
 
27
('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
 
28
('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
 
29
('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
 
30
('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
 
31
('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
 
32
('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
 
33
('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
 
34
('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
 
35
('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
 
36
('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
 
37
('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
 
38
('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
 
39
('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
 
40
('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4'),
 
41
('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
 
42
('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
 
43
('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
 
44
('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
 
45
('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
 
46
('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
 
47
('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
 
48
('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
 
49
('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
 
50
('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
 
51
('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
 
52
('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
 
53
('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
 
54
('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
 
55
('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
 
56
('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4');
 
57
 
 
58
create index idx12672_0 on t4 (a1);
 
59
create index idx12672_1 on t4 (a1,a2,b,c);
 
60
create index idx12672_2 on t4 (a1,a2,b);
 
61
analyze table t4;
 
62
 
 
63
select distinct a1 from t4 where pk_col not in (1,2,3,4);
 
64
 
 
65
drop table t4;
 
66
 
 
67
 
 
68
#
 
69
# Bug #6142: a problem with the empty innodb table
 
70
#
 
71
 
 
72
--disable_warnings
 
73
create table t1 (
 
74
  a varchar(30), b varchar(30), primary key(a), key(b)
 
75
) engine=innodb;
 
76
--enable_warnings
 
77
select distinct a from t1;
 
78
drop table t1;
 
79
 
 
80
#
 
81
# Bug #9798: group by with rollup
 
82
#
 
83
 
 
84
--disable_warnings
 
85
create table t1(a int, key(a)) engine=innodb;
 
86
--enable_warnings
 
87
insert into t1 values(1);
 
88
select a, count(a) from t1 group by a with rollup;
 
89
drop table t1;
 
90
 
 
91
 
 
92
#
 
93
# Bug #13293 Wrongly used index results in endless loop.
 
94
#
 
95
create table t1 (f1 int, f2 char(1), primary key(f1,f2)) engine=innodb;
 
96
insert into t1 values ( 1,"e"),(2,"a"),( 3,"c"),(4,"d");
 
97
alter table t1 drop primary key, add primary key (f2, f1);
 
98
explain select distinct f1 a, f1 b from t1;
 
99
explain select distinct f1, f2 from t1;
 
100
drop table t1;
 
101
 
 
102
 
 
103
#
 
104
# Bug #36632: Select distinct from a simple view on an InnoDB table
 
105
#             returns incorrect results
 
106
#
 
107
create table t1(pk int primary key) engine=innodb;
 
108
create view v1 as select pk from t1 where pk < 20;
 
109
 
 
110
insert into t1 values (1), (2), (3), (4);
 
111
select distinct pk from v1;
 
112
 
 
113
insert into t1 values (5), (6), (7);
 
114
select distinct pk from v1;
 
115
 
 
116
drop view v1;
 
117
drop table t1;
 
118
 
 
119
--echo End of 5.1 tests