~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/heap_btree.test

pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build
macros.
Add PANDORA_DRIZZLE_BUILD to run the extra checks that drizzle needs that 
plugins would also need to run so we can just use that macro in generated
external plugin builds.
Added support to register_plugins for external plugin building.
Renamed register_plugins.py to pandora-plugin.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
drop table if exists t1;
7
7
--enable_warnings
8
8
 
9
 
create table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100;
 
9
create temporary table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=heap comment="testing heaps";
10
10
insert into t1 values(1,1),(2,2),(3,3),(4,4);
11
11
delete from t1 where a=1 or a=0;
12
12
#show table status like "t1";
20
20
alter table t1 add c int not null, add key using BTREE (c,a);
21
21
drop table t1;
22
22
 
23
 
create table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=heap comment="testing heaps";
 
23
create temporary table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=heap comment="testing heaps";
24
24
insert into t1 values(-2,-2),(-1,-1),(0,0),(1,1),(2,2),(3,3),(4,4);
25
25
delete from t1 where a > -3;
26
26
select * from t1;
27
27
drop table t1;
28
28
 
29
 
create table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=heap comment="testing heaps";
 
29
create temporary table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=heap comment="testing heaps";
30
30
insert into t1 values(1,1),(2,2),(3,3),(4,4);
31
 
alter table t1 modify a int not null auto_increment, engine=myisam, comment="new myisam table";
 
31
alter table t1 modify a int not null auto_increment, engine=innodb, comment="new innodb table";
32
32
#show table status like "t1";
33
33
select * from t1;
34
34
drop table t1;
35
35
 
36
 
create table t1 (a int not null) engine=heap;
 
36
create temporary table t1 (a int not null) engine=heap;
37
37
insert into t1 values (869751),(736494),(226312),(802616),(728912);
38
38
select * from t1 where a > 736494;
39
39
alter table t1 add unique uniq_id using BTREE (a);
41
41
select * from t1 where a = 736494;
42
42
select * from t1 where a=869751 or a=736494;
43
43
select * from t1 where a in (869751,736494,226312,802616);
44
 
alter table t1 engine=myisam;
 
44
alter table t1 engine=innodb;
45
45
explain select * from t1 where a in (869751,736494,226312,802616);
46
46
drop table t1;
47
47
 
48
 
create table t1 (x int not null, y int not null, key x  using BTREE (x,y), unique y  using BTREE (y))
 
48
create temporary table t1 (x int not null, y int not null, key x  using BTREE (x,y), unique y  using BTREE (y))
49
49
engine=heap;
50
50
insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6);
51
51
explain select * from t1 where x=1;
52
52
select * from t1 where x=1;
 
53
-- error 1137
53
54
select * from t1,t1 as t2 where t1.x=t2.y;
 
55
-- error 1137
54
56
explain select * from t1,t1 as t2 where t1.x=t2.y;
55
57
drop table t1;
56
58
 
57
 
create table t1 (a int) engine=heap;
 
59
create temporary table t1 (a int) engine=heap;
58
60
insert into t1 values(1);
59
61
select max(a) from t1;
60
62
drop table t1;
61
63
 
62
 
CREATE TABLE t1 ( a int not null default 0, b int not null default 0,  key  using BTREE (a,b),  key  using BTREE (b)  ) ENGINE=HEAP;
 
64
CREATE TEMPORARY TABLE t1 ( a int not null default 0, b int not null default 0,  key  using BTREE (a,b),  key  using BTREE (b)  ) ENGINE=HEAP;
63
65
insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
64
66
select * from t1 where a=1; 
65
67
insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
73
75
explain select * from t1 where b=1;
74
76
drop table t1;
75
77
 
76
 
create table t1 (id int unsigned not null, primary key  using BTREE (id)) engine=HEAP;
 
78
create temporary table t1 (id int not null, primary key  using BTREE (id)) engine=HEAP;
77
79
insert into t1 values(1);
78
80
select max(id) from t1; 
79
81
insert into t1 values(2);
81
83
replace into t1 values(1);
82
84
drop table t1;
83
85
 
84
 
create table t1 (n int) engine=heap;
 
86
create temporary table t1 (n int) engine=heap;
85
87
drop table t1;
86
88
 
87
 
create table t1 (n int) engine=heap;
 
89
create temporary table t1 (n int) engine=heap;
88
90
drop table if exists t1;
89
91
 
90
92
# Test of non unique index
91
93
 
92
 
CREATE table t1(f1 int not null,f2 char(20) not 
 
94
CREATE TEMPORARY table t1(f1 int not null,f2 char(20) not 
93
95
null,index(f2)) engine=heap;
94
96
INSERT into t1 set f1=12,f2="bill";
95
97
INSERT into t1 set f1=13,f2="bill";
108
110
# Test when using part key searches
109
111
#
110
112
 
111
 
create table t1 (btn char(10) not null, key using BTREE (btn)) engine=heap;
 
113
create temporary table t1 (btn char(10) not null, key using BTREE (btn)) engine=heap;
112
114
insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
113
115
explain select * from t1 where btn like "i%";
114
116
--replace_column 9 #
129
131
# Test of NULL keys
130
132
#
131
133
 
132
 
CREATE TABLE t1 (
 
134
CREATE TEMPORARY TABLE t1 (
133
135
  a int default NULL,
134
136
  b int default NULL,
135
137
  KEY a using BTREE (a),
147
149
INSERT INTO t1 VALUES (1,3);
148
150
DROP TABLE t1;
149
151
 
150
 
CREATE TABLE t1 (a int, b int, c int, key using BTREE (a, b, c)) engine=heap;
 
152
CREATE TEMPORARY TABLE t1 (a int, b int, c int, key using BTREE (a, b, c)) engine=heap;
151
153
INSERT INTO t1 VALUES (1, NULL, NULL), (1, 1, NULL), (1, NULL, 1);
152
154
SELECT * FROM t1 WHERE a=1 and b IS NULL;
153
155
SELECT * FROM t1 WHERE a=1 and c IS NULL;
158
160
# Test when deleting all rows
159
161
#
160
162
 
161
 
CREATE TABLE t1 (a int not null, primary key using BTREE (a)) engine=heap;
 
163
CREATE TEMPORARY TABLE t1 (a int not null, primary key using BTREE (a)) engine=heap;
162
164
INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11);
163
165
DELETE from t1 where a < 100;
164
166
SELECT * from t1;
168
170
# Bug #9719: problem with delete
169
171
#
170
172
 
171
 
create table t1(a int not null, key using btree(a)) engine=heap;
 
173
create temporary table t1(a int not null, key using btree(a)) engine=heap;
172
174
insert into t1 values (2), (2), (2), (1), (1), (3), (3), (3), (3);
173
175
select a from t1 where a > 2 order by a;
174
176
delete from t1 where a < 4;
185
187
#
186
188
# Bug#26996 - Update of a Field in a Memory Table ends with wrong result
187
189
#
188
 
CREATE TABLE t1 (
 
190
CREATE TEMPORARY TABLE t1 (
189
191
  c1 CHAR(3),
190
192
  c2 INTEGER,
191
193
  KEY USING BTREE(c1),
200
202
# Bug#24985 - UTF8 ENUM primary key on MEMORY using BTREE
201
203
#             causes incorrect duplicate entries
202
204
#
203
 
CREATE TABLE t1 (
 
205
CREATE TEMPORARY TABLE t1 (
204
206
  c1 ENUM('1', '2'),
205
207
  UNIQUE USING BTREE(c1)
206
 
) ENGINE= MEMORY DEFAULT CHARSET= utf8;
 
208
) ENGINE= MEMORY;
207
209
INSERT INTO t1 VALUES('1'), ('2');
208
210
DROP TABLE t1;
209
211
 
210
212
#
211
213
# BUG#30590 - delete from memory table with composite btree primary key
212
214
#
213
 
CREATE TABLE t1 (a INT, KEY USING BTREE(a)) ENGINE=MEMORY;
 
215
CREATE TEMPORARY TABLE t1 (a INT, KEY USING BTREE(a)) ENGINE=MEMORY;
214
216
INSERT INTO t1 VALUES(1),(2),(2);
215
217
DELETE FROM t1 WHERE a=2;
216
218
SELECT * FROM t1;
221
223
#
222
224
# BUG#18160 - Memory-/HEAP Table endless growing indexes
223
225
#
224
 
CREATE TABLE t1(val INT, KEY USING BTREE(val)) ENGINE=memory;
 
226
CREATE TEMPORARY TABLE t1(val INT, KEY USING BTREE(val)) ENGINE=memory;
225
227
INSERT INTO t1 VALUES(0);
226
228
--replace_result 37 21
227
229
SELECT INDEX_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='t1';
234
236
# BUG#12873 - BTREE index on MEMORY table with multiple NULL values doesn't
235
237
# work properly
236
238
#
237
 
CREATE TABLE t1 (a INT, UNIQUE USING BTREE(a)) ENGINE=MEMORY;
 
239
CREATE TEMPORARY TABLE t1 (a INT, UNIQUE USING BTREE(a)) ENGINE=MEMORY;
238
240
INSERT INTO t1 VALUES(NULL),(NULL);
239
241
DROP TABLE t1;
240
242
 
241
243
#
242
244
# Bug #30885: MEMORY returns incorrect data if BTREE index is used for NULL lookup
243
245
#
244
 
create table t1(a varchar(255), b varchar(255), 
 
246
create temporary table t1(a varchar(255), b varchar(255), 
245
247
                key using btree (a,b)) engine=memory; 
246
248
insert into t1 values (1, 1), (3, 3), (2, 2), (NULL, 1), (NULL, NULL), (0, 0);
247
249
select * from t1 where a is null;