~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/heap_btree.result

Extracted the LOAD command into its own class and implementation files.
Removed the corresponding case label from the switch statement.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
drop table if exists t1;
2
 
create temporary 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;
 
2
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;
3
3
insert into t1 values(1,1),(2,2),(3,3),(4,4);
4
4
delete from t1 where a=1 or a=0;
5
5
show keys from t1;
23
23
4       6
24
24
alter table t1 add c int not null, add key using BTREE (c,a);
25
25
drop table t1;
26
 
create temporary table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=heap comment="testing heaps";
 
26
create table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=heap comment="testing heaps";
27
27
insert into t1 values(-2,-2),(-1,-1),(0,0),(1,1),(2,2),(3,3),(4,4);
28
28
delete from t1 where a > -3;
29
29
select * from t1;
30
30
a       b
31
31
drop table t1;
32
 
create temporary table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=heap comment="testing heaps";
 
32
create table t1 (a int not null,b int not null, primary key using BTREE (a)) engine=heap comment="testing heaps";
33
33
insert into t1 values(1,1),(2,2),(3,3),(4,4);
34
34
alter table t1 modify a int not null auto_increment, engine=innodb, comment="new innodb table";
35
35
select * from t1;
39
39
3       3
40
40
4       4
41
41
drop table t1;
42
 
create temporary table t1 (a int not null) engine=heap;
 
42
create table t1 (a int not null) engine=heap;
43
43
insert into t1 values (869751),(736494),(226312),(802616),(728912);
44
44
select * from t1 where a > 736494;
45
45
a
68
68
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
69
69
1       SIMPLE  t1      index   uniq_id uniq_id 4       NULL    5       Using where; Using index
70
70
drop table t1;
71
 
create temporary table t1 (x int not null, y int not null, key x  using BTREE (x,y), unique y  using BTREE (y))
 
71
create table t1 (x int not null, y int not null, key x  using BTREE (x,y), unique y  using BTREE (y))
72
72
engine=heap;
73
73
insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6);
74
74
explain select * from t1 where x=1;
79
79
1       1
80
80
1       3
81
81
select * from t1,t1 as t2 where t1.x=t2.y;
82
 
ERROR HY000: Can't reopen table: 't1'
 
82
x       y       x       y
 
83
1       1       1       1
 
84
2       2       2       2
 
85
1       3       1       1
 
86
2       4       2       2
 
87
2       5       2       2
 
88
2       6       2       2
83
89
explain select * from t1,t1 as t2 where t1.x=t2.y;
84
 
ERROR HY000: Can't reopen table: 't1'
 
90
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
91
1       SIMPLE  t1      ALL     x       NULL    NULL    NULL    6       
 
92
1       SIMPLE  t2      eq_ref  y       y       4       test.t1.x       1       
85
93
drop table t1;
86
 
create temporary table t1 (a int) engine=heap;
 
94
create table t1 (a int) engine=heap;
87
95
insert into t1 values(1);
88
96
select max(a) from t1;
89
97
max(a)
90
98
1
91
99
drop table t1;
92
 
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;
 
100
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;
93
101
insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
94
102
select * from t1 where a=1;
95
103
a       b
128
136
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
129
137
x       SIMPLE  tx      ref     b       b       x       const   x       
130
138
drop table t1;
131
 
create temporary table t1 (id int not null, primary key  using BTREE (id)) engine=HEAP;
 
139
create table t1 (id int not null, primary key  using BTREE (id)) engine=HEAP;
132
140
insert into t1 values(1);
133
141
select max(id) from t1;
134
142
max(id)
139
147
2
140
148
replace into t1 values(1);
141
149
drop table t1;
142
 
create temporary table t1 (n int) engine=heap;
 
150
create table t1 (n int) engine=heap;
143
151
drop table t1;
144
 
create temporary table t1 (n int) engine=heap;
 
152
create table t1 (n int) engine=heap;
145
153
drop table if exists t1;
146
 
CREATE TEMPORARY table t1(f1 int not null,f2 char(20) not 
 
154
CREATE table t1(f1 int not null,f2 char(20) not 
147
155
null,index(f2)) engine=heap;
148
156
INSERT into t1 set f1=12,f2="bill";
149
157
INSERT into t1 set f1=13,f2="bill";
163
171
12      ted
164
172
12      ted
165
173
drop table t1;
166
 
create temporary table t1 (btn char(10) not null, key using BTREE (btn)) engine=heap;
 
174
create table t1 (btn char(10) not null, key using BTREE (btn)) engine=heap;
167
175
insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
168
176
explain select * from t1 where btn like "i%";
169
177
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
192
200
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
193
201
1       SIMPLE  t1      ref     btn     btn     48      const,const     1       Using where
194
202
drop table t1;
195
 
CREATE TEMPORARY TABLE t1 (
 
203
CREATE TABLE t1 (
196
204
a int default NULL,
197
205
b int default NULL,
198
206
KEY a using BTREE (a),
218
226
INSERT INTO t1 VALUES (1,3);
219
227
ERROR 23000: Duplicate entry '3' for key 'b'
220
228
DROP TABLE t1;
221
 
CREATE TEMPORARY TABLE t1 (a int, b int, c int, key using BTREE (a, b, c)) engine=heap;
 
229
CREATE TABLE t1 (a int, b int, c int, key using BTREE (a, b, c)) engine=heap;
222
230
INSERT INTO t1 VALUES (1, NULL, NULL), (1, 1, NULL), (1, NULL, 1);
223
231
SELECT * FROM t1 WHERE a=1 and b IS NULL;
224
232
a       b       c
232
240
a       b       c
233
241
1       NULL    NULL
234
242
DROP TABLE t1;
235
 
CREATE TEMPORARY TABLE t1 (a int not null, primary key using BTREE (a)) engine=heap;
 
243
CREATE TABLE t1 (a int not null, primary key using BTREE (a)) engine=heap;
236
244
INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11);
237
245
DELETE from t1 where a < 100;
238
246
SELECT * from t1;
239
247
a
240
248
DROP TABLE t1;
241
 
create temporary table t1(a int not null, key using btree(a)) engine=heap;
 
249
create table t1(a int not null, key using btree(a)) engine=heap;
242
250
insert into t1 values (2), (2), (2), (1), (1), (3), (3), (3), (3);
243
251
select a from t1 where a > 2 order by a;
244
252
a
272
280
1
273
281
1
274
282
drop table t1;
275
 
CREATE TEMPORARY TABLE t1 (
 
283
CREATE TABLE t1 (
276
284
c1 CHAR(3),
277
285
c2 INTEGER,
278
286
KEY USING BTREE(c1),
287
295
B       0
288
296
C       0
289
297
DROP TABLE t1;
290
 
CREATE TEMPORARY TABLE t1 (
 
298
CREATE TABLE t1 (
291
299
c1 ENUM('1', '2'),
292
300
UNIQUE USING BTREE(c1)
293
301
) ENGINE= MEMORY;
294
302
INSERT INTO t1 VALUES('1'), ('2');
295
303
DROP TABLE t1;
296
 
CREATE TEMPORARY TABLE t1 (a INT, KEY USING BTREE(a)) ENGINE=MEMORY;
 
304
CREATE TABLE t1 (a INT, KEY USING BTREE(a)) ENGINE=MEMORY;
297
305
INSERT INTO t1 VALUES(1),(2),(2);
298
306
DELETE FROM t1 WHERE a=2;
299
307
SELECT * FROM t1;
301
309
1
302
310
DROP TABLE t1;
303
311
End of 4.1 tests
304
 
CREATE TEMPORARY TABLE t1(val INT, KEY USING BTREE(val)) ENGINE=memory;
 
312
CREATE TABLE t1(val INT, KEY USING BTREE(val)) ENGINE=memory;
305
313
INSERT INTO t1 VALUES(0);
306
314
SELECT INDEX_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='t1';
307
315
INDEX_LENGTH
 
316
21
308
317
UPDATE t1 SET val=1;
309
318
SELECT INDEX_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='t1';
310
319
INDEX_LENGTH
 
320
21
311
321
DROP TABLE t1;
312
 
CREATE TEMPORARY TABLE t1 (a INT, UNIQUE USING BTREE(a)) ENGINE=MEMORY;
 
322
CREATE TABLE t1 (a INT, UNIQUE USING BTREE(a)) ENGINE=MEMORY;
313
323
INSERT INTO t1 VALUES(NULL),(NULL);
314
324
DROP TABLE t1;
315
 
create temporary table t1(a varchar(255), b varchar(255), 
 
325
create table t1(a varchar(255), b varchar(255), 
316
326
key using btree (a,b)) engine=memory;
317
327
insert into t1 values (1, 1), (3, 3), (2, 2), (NULL, 1), (NULL, NULL), (0, 0);
318
328
select * from t1 where a is null;