~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/heap.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,t2,t3;
2
 
create temporary table t1 (a int not null,b int not null, primary key (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 (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 (c,a);
25
25
drop table t1;
26
 
create temporary table t1 (a int not null,b int not null, primary key (a)) engine=memory comment="testing heaps";
 
26
create table t1 (a int not null,b int not null, primary key (a)) engine=memory comment="testing heaps";
27
27
insert into t1 values(1,1),(2,2),(3,3),(4,4);
28
28
delete from t1 where a > 0;
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 (a)) engine=heap comment="testing heaps";
 
32
create table t1 (a int not null,b int not null, primary key (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
63
63
736494
64
64
802616
65
65
869751
66
 
create temporary table t2 SELECT * FROM t1;
 
66
create table t2 SELECT * FROM t1;
67
67
explain select * from t2 where a in (869751,736494,226312,802616);
68
68
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
69
69
1       SIMPLE  t2      ALL     NULL    NULL    NULL    NULL    5       Using where
70
70
drop table t1,t2;
71
 
create temporary table t1 (x int not null, y int not null, key x (x), unique y (y))
 
71
create table t1 (x int not null, y int not null, key x (x), unique y (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
select * from t1 where x=1;
76
76
1       3
77
77
1       1
78
78
select * from t1,t1 as t2 where t1.x=t2.y;
79
 
ERROR HY000: Can't reopen table: 't1'
 
79
x       y       x       y
 
80
1       1       1       1
 
81
2       2       2       2
 
82
1       3       1       1
 
83
2       4       2       2
 
84
2       5       2       2
 
85
2       6       2       2
80
86
explain select * from t1,t1 as t2 where t1.x=t2.y;
81
 
ERROR HY000: Can't reopen table: 't1'
 
87
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
88
1       SIMPLE  t1      ALL     x       NULL    NULL    NULL    6       
 
89
1       SIMPLE  t2      eq_ref  y       y       4       test.t1.x       1       
82
90
drop table t1;
83
 
create temporary table t1 (a int) engine=heap;
 
91
create table t1 (a int) engine=heap;
84
92
insert into t1 values(1);
85
93
select max(a) from t1;
86
94
max(a)
87
95
1
88
96
drop table t1;
89
 
CREATE TEMPORARY TABLE t1 ( a int not null default 0, b int not null default 0,  key(a),  key(b)  ) ENGINE=HEAP;
 
97
CREATE TABLE t1 ( a int not null default 0, b int not null default 0,  key(a),  key(b)  ) ENGINE=HEAP;
90
98
insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
91
99
select * from t1 where a=1;
92
100
a       b
112
120
1       2
113
121
1       1
114
122
drop table t1;
115
 
create temporary table t1 (id int not null, primary key (id)) engine=HEAP;
 
123
create table t1 (id int not null, primary key (id)) engine=HEAP;
116
124
insert into t1 values(1);
117
125
select max(id) from t1;
118
126
max(id)
123
131
2
124
132
replace into t1 values(1);
125
133
drop table t1;
126
 
create temporary table t1 (n int) engine=heap;
 
134
create table t1 (n int) engine=heap;
127
135
drop table t1;
128
 
create temporary table t1 (n int) engine=heap;
 
136
create table t1 (n int) engine=heap;
129
137
drop table if exists t1;
130
 
CREATE TEMPORARY table t1(f1 int not null,f2 char(20) not 
 
138
CREATE table t1(f1 int not null,f2 char(20) not 
131
139
null,index(f2)) engine=heap;
132
140
INSERT into t1 set f1=12,f2="bill";
133
141
INSERT into t1 set f1=13,f2="bill";
147
155
12      ted
148
156
12      ted
149
157
drop table t1;
150
 
create temporary table t1 (btn char(10) not null, key(btn)) engine=heap;
 
158
create table t1 (btn char(10) not null, key(btn)) engine=heap;
151
159
insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
152
160
explain select * from t1 where btn like "q%";
153
161
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
163
171
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
164
172
1       SIMPLE  t1      ref     btn     btn     48      const,const     2       Using where
165
173
drop table t1;
166
 
CREATE TEMPORARY TABLE t1 (
 
174
CREATE TABLE t1 (
167
175
a int default NULL,
168
176
b int default NULL,
169
177
KEY a (a),
189
197
INSERT INTO t1 VALUES (1,3);
190
198
ERROR 23000: Duplicate entry '3' for key 'b'
191
199
DROP TABLE t1;
192
 
CREATE TEMPORARY TABLE t1 (
 
200
CREATE TABLE t1 (
193
201
a int default NULL,
194
202
key a (a)
195
203
) ENGINE=HEAP;
203
211
10
204
212
10
205
213
DROP TABLE t1;
206
 
CREATE TEMPORARY TABLE t1 (a int not null, primary key(a)) engine=heap;
 
214
CREATE TABLE t1 (a int not null, primary key(a)) engine=heap;
207
215
INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11);
208
216
DELETE from t1 where a < 100;
209
217
SELECT * from t1;
210
218
a
211
219
DROP TABLE t1;
212
 
CREATE TEMPORARY TABLE `job_titles` (
 
220
CREATE TABLE `job_titles` (
213
221
`job_title_id` int NOT NULL default '0',
214
222
`job_title` char(18) NOT NULL default '',
215
223
PRIMARY KEY  (`job_title_id`),
219
227
MAX(job_title_id)
220
228
NULL
221
229
DROP TABLE job_titles;
222
 
CREATE TEMPORARY TABLE t1 (a INT NOT NULL, B INT, KEY(B)) ENGINE=HEAP;
 
230
CREATE TABLE t1 (a INT NOT NULL, B INT, KEY(B)) ENGINE=HEAP;
223
231
INSERT INTO t1 VALUES(1,1), (1,NULL);
224
232
SELECT * FROM t1 WHERE B is not null;
225
233
a       B
226
234
1       1
227
235
DROP TABLE t1;
228
 
CREATE TEMPORARY TABLE t1 (pseudo char(35) PRIMARY KEY, date int NOT NULL) ENGINE=HEAP;
 
236
CREATE TABLE t1 (pseudo char(35) PRIMARY KEY, date int NOT NULL) ENGINE=HEAP;
229
237
INSERT INTO t1 VALUES ('massecot',1101106491),('altec',1101106492),('stitch+',1101106304),('Seb Corgan',1101106305),('beerfilou',1101106263),('flaker',1101106529),('joce8',5),('M4vrick',1101106418),('gabay008',1101106525),('Vamp irX',1101106291),('ZoomZip',1101106546),('rip666',1101106502),('CBP ',1101106397),('guezpard',1101106496);
230
238
DELETE FROM t1 WHERE date<1101106546;
231
239
SELECT * FROM t1;
232
240
pseudo  date
233
241
ZoomZip 1101106546
234
242
DROP TABLE t1;
235
 
create temporary table t1(a char(2)) engine=memory;
 
243
create table t1(a char(2)) engine=memory;
236
244
insert into t1 values (NULL), (NULL);
237
245
delete from t1 where a is null;
238
246
insert into t1 values ('2'), ('3');
242
250
2
243
251
drop table t1;
244
252
set storage_engine=HEAP;
245
 
create temporary table t1 (v varchar(10), c char(10), t varchar(50));
 
253
create table t1 (v varchar(10), c char(10), t varchar(50));
246
254
insert into t1 values('+ ', '+ ', '+ ');
247
255
set @a=repeat(' ',20);
248
256
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
255
263
*+         *+         *+                    *
256
264
show create table t1;
257
265
Table   Create Table
258
 
t1      CREATE TEMPORARY TABLE `t1` (
 
266
t1      CREATE TABLE `t1` (
259
267
  `v` varchar(10) DEFAULT NULL,
260
268
  `c` varchar(10) DEFAULT NULL,
261
269
  `t` varchar(50) DEFAULT NULL
262
270
) ENGINE=MEMORY
263
 
create temporary table t2 like t1;
 
271
create table t2 like t1;
264
272
show create table t2;
265
273
Table   Create Table
266
 
t2      CREATE TEMPORARY TABLE `t2` (
 
274
t2      CREATE TABLE `t2` (
267
275
  `v` varchar(10) DEFAULT NULL,
268
276
  `c` varchar(10) DEFAULT NULL,
269
277
  `t` varchar(50) DEFAULT NULL
270
278
) ENGINE=MEMORY
271
 
create temporary table t3 select * from t1;
 
279
create table t3 select * from t1;
272
280
show create table t3;
273
281
Table   Create Table
274
 
t3      CREATE TEMPORARY TABLE `t3` (
 
282
t3      CREATE TABLE `t3` (
275
283
  `v` varchar(10) DEFAULT NULL,
276
284
  `c` varchar(10) DEFAULT NULL,
277
285
  `t` varchar(50) DEFAULT NULL
279
287
alter table t1 modify c varchar(10);
280
288
show create table t1;
281
289
Table   Create Table
282
 
t1      CREATE TEMPORARY TABLE `t1` (
 
290
t1      CREATE TABLE `t1` (
283
291
  `v` varchar(10) DEFAULT NULL,
284
292
  `c` varchar(10) DEFAULT NULL,
285
293
  `t` varchar(50) DEFAULT NULL
287
295
alter table t1 modify v char(10);
288
296
show create table t1;
289
297
Table   Create Table
290
 
t1      CREATE TEMPORARY TABLE `t1` (
 
298
t1      CREATE TABLE `t1` (
291
299
  `v` varchar(10) DEFAULT NULL,
292
300
  `c` varchar(10) DEFAULT NULL,
293
301
  `t` varchar(50) DEFAULT NULL
295
303
alter table t1 modify t varchar(50);
296
304
show create table t1;
297
305
Table   Create Table
298
 
t1      CREATE TEMPORARY TABLE `t1` (
 
306
t1      CREATE TABLE `t1` (
299
307
  `v` varchar(10) DEFAULT NULL,
300
308
  `c` varchar(10) DEFAULT NULL,
301
309
  `t` varchar(50) DEFAULT NULL
305
313
*+ *+ *+ *
306
314
*+         *+         *+                    *
307
315
drop table t1,t2,t3;
308
 
create temporary table t1 (v varchar(10), c char(10), t varchar(50), key(v), key(c), key(t(10)));
 
316
create table t1 (v varchar(10), c char(10), t varchar(50), key(v), key(c), key(t(10)));
309
317
show create table t1;
310
318
Table   Create Table
311
 
t1      CREATE TEMPORARY TABLE `t1` (
 
319
t1      CREATE TABLE `t1` (
312
320
  `v` varchar(10) DEFAULT NULL,
313
321
  `c` varchar(10) DEFAULT NULL,
314
322
  `t` varchar(50) DEFAULT NULL,
512
520
h       10
513
521
i       10
514
522
drop table t1;
515
 
create temporary table t1 (a char(10), unique (a));
 
523
create table t1 (a char(10), unique (a));
516
524
insert into t1 values ('a');
517
525
insert into t1 values ('a ');
518
526
ERROR 23000: Duplicate entry 'a ' for key 'a'
528
536
update t1 set a='a      ' where a like 'a ';
529
537
update t1 set a='a  ' where a like 'a      ';
530
538
drop table t1;
531
 
create temporary table t1 (v varchar(10), c char(10), t varchar(50), key using btree (v), key using btree (c), key using btree (t(10)));
 
539
create table t1 (v varchar(10), c char(10), t varchar(50), key using btree (v), key using btree (c), key using btree (t(10)));
532
540
show create table t1;
533
541
Table   Create Table
534
 
t1      CREATE TEMPORARY TABLE `t1` (
 
542
t1      CREATE TABLE `t1` (
535
543
  `v` varchar(10) DEFAULT NULL,
536
544
  `c` varchar(10) DEFAULT NULL,
537
545
  `t` varchar(50) DEFAULT NULL,
603
611
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
604
612
1       SIMPLE  t1      ref     v       v       43      const   #       Using where
605
613
drop table t1;
606
 
create temporary table t1 (a char(10), unique using btree (a)) engine=heap;
 
614
create table t1 (a char(10), unique using btree (a)) engine=heap;
607
615
insert into t1 values ('a');
608
616
insert into t1 values ('a ');
609
617
ERROR 23000: Duplicate entry 'a ' for key 'a'
619
627
update t1 set a='a      ' where a like 'a ';
620
628
update t1 set a='a  ' where a like 'a      ';
621
629
drop table t1;
622
 
create temporary table t1 (v varchar(10), c char(10), t varchar(50), key(v(5)), key(c(5)), key(t(5)));
 
630
create table t1 (v varchar(10), c char(10), t varchar(50), key(v(5)), key(c(5)), key(t(5)));
623
631
show create table t1;
624
632
Table   Create Table
625
 
t1      CREATE TEMPORARY TABLE `t1` (
 
633
t1      CREATE TABLE `t1` (
626
634
  `v` varchar(10) DEFAULT NULL,
627
635
  `c` varchar(10) DEFAULT NULL,
628
636
  `t` varchar(50) DEFAULT NULL,
631
639
  KEY `t` (`t`(5))
632
640
) ENGINE=MEMORY
633
641
drop table t1;
634
 
create temporary table t1 (v varchar(16383), key(v(10)));
 
642
create table t1 (v varchar(16383), key(v(10)));
635
643
show create table t1;
636
644
Table   Create Table
637
 
t1      CREATE TEMPORARY TABLE `t1` (
 
645
t1      CREATE TABLE `t1` (
638
646
  `v` varchar(16383) DEFAULT NULL,
639
647
  KEY `v` (`v`(10))
640
648
) ENGINE=MEMORY
644
652
16383
645
653
drop table t1;
646
654
set storage_engine=InnoDB;
647
 
create temporary table t1 (a bigint auto_increment primary key, b int,
 
655
create table t1 (a bigint auto_increment primary key, b int,
648
656
key (b, a)) engine=heap;
649
657
insert t1 (b) values (1),(1),(1),(1),(1),(1),(1),(1);
650
658
select * from t1;
658
666
7       1
659
667
8       1
660
668
drop table t1;
661
 
create temporary table t1 (a int not null, b int not null auto_increment,
 
669
create table t1 (a int not null, b int not null auto_increment,
662
670
primary key(a, b), key(b)) engine=heap;
663
671
insert t1 (a) values (1),(1),(1),(1),(1),(1),(1),(1);
664
672
select * from t1;
672
680
1       7
673
681
1       8
674
682
drop table t1;
675
 
create temporary table t1 (a int not null, b int not null auto_increment,
 
683
create table t1 (a int not null, b int not null auto_increment,
676
684
primary key(a, b)) engine=heap;
677
685
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
678
 
create temporary table t1 (c char(255), primary key(c(90)));
 
686
create table t1 (c char(255), primary key(c(90)));
679
687
insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
680
688
insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
681
689
ERROR 23000: Duplicate entry 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl' for key 'PRIMARY'
682
690
drop table t1;
683
 
CREATE TEMPORARY TABLE t1 (a int, key(a)) engine=heap;
 
691
CREATE TABLE t1 (a int, key(a)) engine=heap;
684
692
insert into t1 values (0);
685
693
delete from t1;
686
694
select * from t1;
690
698
a
691
699
0
692
700
drop table t1;
693
 
create temporary table t1 (c char(10)) engine=memory;
694
 
create temporary table t2 (c varchar(10)) engine=memory;
 
701
create table t1 (c char(10)) engine=memory;
 
702
create table t2 (c varchar(10)) engine=memory;
695
703
show table status like 't_';
696
704
Name    Engine  Version Row_format      Rows    Avg_row_length  Data_length     Max_data_length Index_length    Data_free       Auto_increment  Create_time     Update_time     Check_time      Collation       Checksum        Create_options  Comment
 
705
t1      MEMORY  #       Fixed   0       42      0       #       0       0       NULL    NULL    NULL    NULL    utf8_general_ci NULL            
 
706
t2      MEMORY  #       Fixed   0       42      0       #       0       0       NULL    NULL    NULL    NULL    utf8_general_ci NULL            
697
707
drop table t1, t2;
698
 
CREATE TEMPORARY TABLE t1(a VARCHAR(1), b VARCHAR(2), c VARCHAR(256),
 
708
CREATE TABLE t1(a VARCHAR(1), b VARCHAR(2), c VARCHAR(256),
699
709
KEY(a), KEY(b), KEY(c)) ENGINE=MEMORY;
700
710
INSERT INTO t1 VALUES('a','aa',REPEAT('a', 256)),('a','aa',REPEAT('a',256));
701
711
SELECT COUNT(*) FROM t1 WHERE a='a';
708
718
COUNT(*)
709
719
2
710
720
DROP TABLE t1;
711
 
CREATE TEMPORARY TABLE t1(c1 VARCHAR(100), c2 INT) ENGINE=MEMORY;
 
721
CREATE TABLE t1(c1 VARCHAR(100), c2 INT) ENGINE=MEMORY;
712
722
INSERT INTO t1 VALUES('', 0);
713
723
ALTER TABLE t1 MODIFY c1 VARCHAR(101);
714
724
SELECT c2 FROM t1;