~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/heap.result

  • Committer: Brian Aker
  • Date: 2010-01-22 00:53:13 UTC
  • Revision ID: brian@gaz-20100122005313-jmizcbcdi1lt4tcx
Revert db patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
drop table if exists t1,t2,t3;
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;
 
2
create temporary table t1 (a int not null,b int not null, primary key (a)) engine=MEMORY comment="testing heaps";
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 table t1 (a int not null,b int not null, primary key (a)) engine=memory comment="testing heaps";
 
26
create temporary 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 table t1 (a int not null,b int not null, primary key (a)) engine=heap comment="testing heaps";
 
32
create temporary table t1 (a int not null,b int not null, primary key (a)) engine=MEMORY comment="testing heaps";
33
33
insert into t1 values(1,1),(2,2),(3,3),(4,4);
34
 
alter table t1 modify a int not null auto_increment, engine=myisam, comment="new myisam table";
 
34
alter table t1 modify a int not null auto_increment, engine=innodb, comment="new innodb table";
35
35
select * from t1;
36
36
a       b
37
37
1       1
39
39
3       3
40
40
4       4
41
41
drop table t1;
42
 
create table t1 (a int not null) engine=heap;
 
42
create temporary table t1 (a int not null) engine=MEMORY;
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
 
alter table t1 engine=myisam;
67
 
explain select * from t1 where a in (869751,736494,226312,802616);
 
66
create temporary table t2 SELECT * FROM t1;
 
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
 
1       SIMPLE  t1      range   uniq_id uniq_id 4       NULL    4       Using where; Using index
70
 
drop table t1;
71
 
create table t1 (x int not null, y int not null, key x (x), unique y (y))
72
 
engine=heap;
 
69
1       SIMPLE  t2      ALL     NULL    NULL    NULL    NULL    5       Using where
 
70
drop table t1,t2;
 
71
create temporary table t1 (x int not null, y int not null, key x (x), unique y (y))
 
72
engine=MEMORY;
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;
75
75
x       y
76
76
1       3
77
77
1       1
78
78
select * from t1,t1 as t2 where t1.x=t2.y;
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
 
79
ERROR HY000: Can't reopen table: 't1'
86
80
explain select * from t1,t1 as t2 where t1.x=t2.y;
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       
 
81
ERROR HY000: Can't reopen table: 't1'
90
82
drop table t1;
91
 
create table t1 (a int) engine=heap;
 
83
create temporary table t1 (a int) engine=MEMORY;
92
84
insert into t1 values(1);
93
85
select max(a) from t1;
94
86
max(a)
95
87
1
96
88
drop table t1;
97
 
CREATE TABLE t1 ( a int not null default 0, b int not null default 0,  key(a),  key(b)  ) ENGINE=HEAP;
 
89
CREATE TEMPORARY TABLE t1 ( a int not null default 0, b int not null default 0,  key(a),  key(b)  ) ENGINE=MEMORY;
98
90
insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
99
91
select * from t1 where a=1;
100
92
a       b
120
112
1       2
121
113
1       1
122
114
drop table t1;
123
 
create table t1 (id int unsigned not null, primary key (id)) engine=HEAP;
 
115
create temporary table t1 (id int not null, primary key (id)) engine=MEMORY;
124
116
insert into t1 values(1);
125
117
select max(id) from t1;
126
118
max(id)
131
123
2
132
124
replace into t1 values(1);
133
125
drop table t1;
134
 
create table t1 (n int) engine=heap;
 
126
create temporary table t1 (n int) engine=MEMORY;
135
127
drop table t1;
136
 
create table t1 (n int) engine=heap;
 
128
create temporary table t1 (n int) engine=MEMORY;
137
129
drop table if exists t1;
138
 
CREATE table t1(f1 int not null,f2 char(20) not 
139
 
null,index(f2)) engine=heap;
 
130
CREATE TEMPORARY table t1(f1 int not null,f2 char(20) not 
 
131
null,index(f2)) engine=MEMORY;
140
132
INSERT into t1 set f1=12,f2="bill";
141
133
INSERT into t1 set f1=13,f2="bill";
142
134
INSERT into t1 set f1=14,f2="bill";
155
147
12      ted
156
148
12      ted
157
149
drop table t1;
158
 
create table t1 (btn char(10) not null, key(btn)) engine=heap;
 
150
create temporary table t1 (btn char(10) not null, key(btn)) engine=MEMORY;
159
151
insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
160
152
explain select * from t1 where btn like "q%";
161
153
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
169
161
1       SIMPLE  t1      ALL     btn     NULL    NULL    NULL    14      Using where
170
162
explain select * from t1 where btn="a" and new_col="a";
171
163
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
172
 
1       SIMPLE  t1      ref     btn     btn     15      const,const     2       Using where
 
164
1       SIMPLE  t1      ref     btn     btn     48      const,const     2       Using where
173
165
drop table t1;
174
 
CREATE TABLE t1 (
 
166
CREATE TEMPORARY TABLE t1 (
175
167
a int default NULL,
176
168
b int default NULL,
177
169
KEY a (a),
178
170
UNIQUE b (b)
179
 
) engine=heap;
 
171
) engine=MEMORY;
180
172
INSERT INTO t1 VALUES (NULL,99),(99,NULL),(1,1),(2,2),(1,3);
181
173
SELECT * FROM t1 WHERE a=NULL;
182
174
a       b
197
189
INSERT INTO t1 VALUES (1,3);
198
190
ERROR 23000: Duplicate entry '3' for key 'b'
199
191
DROP TABLE t1;
200
 
CREATE TABLE t1 (
 
192
CREATE TEMPORARY TABLE t1 (
201
193
a int default NULL,
202
194
key a (a)
203
 
) ENGINE=HEAP;
 
195
) ENGINE=MEMORY;
204
196
INSERT INTO t1 VALUES (10), (10), (10);
205
197
EXPLAIN SELECT * FROM t1 WHERE a=10;
206
198
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
211
203
10
212
204
10
213
205
DROP TABLE t1;
214
 
CREATE TABLE t1 (a int not null, primary key(a)) engine=heap;
 
206
CREATE TEMPORARY TABLE t1 (a int not null, primary key(a)) engine=MEMORY;
215
207
INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11);
216
208
DELETE from t1 where a < 100;
217
209
SELECT * from t1;
218
210
a
219
211
DROP TABLE t1;
220
 
CREATE TABLE `job_titles` (
221
 
`job_title_id` int unsigned NOT NULL default '0',
 
212
CREATE TEMPORARY TABLE `job_titles` (
 
213
`job_title_id` int NOT NULL default '0',
222
214
`job_title` char(18) NOT NULL default '',
223
215
PRIMARY KEY  (`job_title_id`),
224
216
UNIQUE KEY `job_title_id` (`job_title_id`,`job_title`)
225
 
) ENGINE=HEAP;
 
217
) ENGINE=MEMORY;
226
218
SELECT MAX(job_title_id) FROM job_titles;
227
219
MAX(job_title_id)
228
220
NULL
229
221
DROP TABLE job_titles;
230
 
CREATE TABLE t1 (a INT NOT NULL, B INT, KEY(B)) ENGINE=HEAP;
 
222
CREATE TEMPORARY TABLE t1 (a INT NOT NULL, B INT, KEY(B)) ENGINE=MEMORY;
231
223
INSERT INTO t1 VALUES(1,1), (1,NULL);
232
224
SELECT * FROM t1 WHERE B is not null;
233
225
a       B
234
226
1       1
235
227
DROP TABLE t1;
236
 
CREATE TABLE t1 (pseudo char(35) PRIMARY KEY, date int unsigned NOT NULL) ENGINE=HEAP;
 
228
CREATE TEMPORARY TABLE t1 (pseudo char(35) PRIMARY KEY, date int NOT NULL) ENGINE=MEMORY;
237
229
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);
238
230
DELETE FROM t1 WHERE date<1101106546;
239
231
SELECT * FROM t1;
240
232
pseudo  date
241
233
ZoomZip 1101106546
242
234
DROP TABLE t1;
243
 
create table t1(a char(2)) engine=memory;
 
235
create temporary table t1(a char(2)) engine=memory;
244
236
insert into t1 values (NULL), (NULL);
245
237
delete from t1 where a is null;
246
238
insert into t1 values ('2'), ('3');
249
241
3
250
242
2
251
243
drop table t1;
252
 
set storage_engine=HEAP;
253
 
create table t1 (v varchar(10), c char(10), t varchar(50));
 
244
set storage_engine=MEMORY;
 
245
create temporary table t1 (v varchar(10), c char(10), t varchar(50));
254
246
insert into t1 values('+ ', '+ ', '+ ');
255
247
set @a=repeat(' ',20);
256
248
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
263
255
*+         *+         *+                    *
264
256
show create table t1;
265
257
Table   Create Table
266
 
t1      CREATE TABLE "t1" (
267
 
  "v" varchar(10),
268
 
  "c" varchar(10),
269
 
  "t" varchar(50)
270
 
) ENGINE=MEMORY DEFAULT CHARSET=latin1
271
 
create table t2 like t1;
 
258
t1      CREATE TEMPORARY TABLE `t1` (
 
259
  `v` varchar(10) DEFAULT NULL,
 
260
  `c` varchar(10) DEFAULT NULL,
 
261
  `t` varchar(50) DEFAULT NULL
 
262
) ENGINE=MEMORY
 
263
create temporary table t2 like t1;
272
264
show create table t2;
273
265
Table   Create Table
274
 
t2      CREATE TABLE "t2" (
275
 
  "v" varchar(10),
276
 
  "c" varchar(10),
277
 
  "t" varchar(50)
278
 
) ENGINE=MEMORY DEFAULT CHARSET=latin1
279
 
create table t3 select * from t1;
 
266
t2      CREATE TEMPORARY TABLE `t2` (
 
267
  `v` varchar(10) DEFAULT NULL,
 
268
  `c` varchar(10) DEFAULT NULL,
 
269
  `t` varchar(50) DEFAULT NULL
 
270
) ENGINE=MEMORY
 
271
create temporary table t3 select * from t1;
280
272
show create table t3;
281
273
Table   Create Table
282
 
t3      CREATE TABLE "t3" (
283
 
  "v" varchar(10),
284
 
  "c" varchar(10),
285
 
  "t" varchar(50)
286
 
) ENGINE=MEMORY DEFAULT CHARSET=latin1
 
274
t3      CREATE TEMPORARY TABLE `t3` (
 
275
  `v` varchar(10) DEFAULT NULL,
 
276
  `c` varchar(10) DEFAULT NULL,
 
277
  `t` varchar(50) DEFAULT NULL
 
278
) ENGINE=MEMORY
287
279
alter table t1 modify c varchar(10);
288
280
show create table t1;
289
281
Table   Create Table
290
 
t1      CREATE TABLE "t1" (
291
 
  "v" varchar(10),
292
 
  "c" varchar(10),
293
 
  "t" varchar(50)
294
 
) ENGINE=MEMORY DEFAULT CHARSET=latin1
 
282
t1      CREATE TEMPORARY TABLE `t1` (
 
283
  `v` varchar(10) DEFAULT NULL,
 
284
  `c` varchar(10) DEFAULT NULL,
 
285
  `t` varchar(50) DEFAULT NULL
 
286
) ENGINE=MEMORY
295
287
alter table t1 modify v char(10);
296
288
show create table t1;
297
289
Table   Create Table
298
 
t1      CREATE TABLE "t1" (
299
 
  "v" varchar(10),
300
 
  "c" varchar(10),
301
 
  "t" varchar(50)
302
 
) ENGINE=MEMORY DEFAULT CHARSET=latin1
 
290
t1      CREATE TEMPORARY TABLE `t1` (
 
291
  `v` varchar(10) DEFAULT NULL,
 
292
  `c` varchar(10) DEFAULT NULL,
 
293
  `t` varchar(50) DEFAULT NULL
 
294
) ENGINE=MEMORY
303
295
alter table t1 modify t varchar(50);
304
296
show create table t1;
305
297
Table   Create Table
306
 
t1      CREATE TABLE "t1" (
307
 
  "v" varchar(10),
308
 
  "c" varchar(10),
309
 
  "t" varchar(50)
310
 
) ENGINE=MEMORY DEFAULT CHARSET=latin1
 
298
t1      CREATE TEMPORARY TABLE `t1` (
 
299
  `v` varchar(10) DEFAULT NULL,
 
300
  `c` varchar(10) DEFAULT NULL,
 
301
  `t` varchar(50) DEFAULT NULL
 
302
) ENGINE=MEMORY
311
303
select concat('*',v,'*',c,'*',t,'*') from t1;
312
304
concat('*',v,'*',c,'*',t,'*')
313
305
*+ *+ *+ *
314
306
*+         *+         *+                    *
315
307
drop table t1,t2,t3;
316
 
create table t1 (v varchar(10), c char(10), t varchar(50), key(v), key(c), key(t(10)));
 
308
create temporary table t1 (v varchar(10), c char(10), t varchar(50), key(v), key(c), key(t(10)));
317
309
show create table t1;
318
310
Table   Create Table
319
 
t1      CREATE TABLE "t1" (
320
 
  "v" varchar(10),
321
 
  "c" varchar(10),
322
 
  "t" varchar(50),
323
 
  KEY "v" ("v"),
324
 
  KEY "c" ("c"),
325
 
  KEY "t" ("t"(10))
326
 
) ENGINE=MEMORY DEFAULT CHARSET=latin1
 
311
t1      CREATE TEMPORARY TABLE `t1` (
 
312
  `v` varchar(10) DEFAULT NULL,
 
313
  `c` varchar(10) DEFAULT NULL,
 
314
  `t` varchar(50) DEFAULT NULL,
 
315
  KEY `v` (`v`),
 
316
  KEY `c` (`c`),
 
317
  KEY `t` (`t`(10))
 
318
) ENGINE=MEMORY
327
319
select count(*) from t1;
328
320
count(*)
329
321
270
366
358
9
367
359
explain select count(*) from t1 where v='a  ';
368
360
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
369
 
1       SIMPLE  t1      ref     v       v       13      const   10      Using where
 
361
1       SIMPLE  t1      ref     v       v       43      const   10      Using where
370
362
explain select count(*) from t1 where c='a  ';
371
363
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
372
 
1       SIMPLE  t1      ref     c       c       13      const   10      Using where
 
364
1       SIMPLE  t1      ref     c       c       43      const   10      Using where
373
365
explain select count(*) from t1 where t='a  ';
374
366
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
375
 
1       SIMPLE  t1      ref     t       t       13      const   10      Using where
 
367
1       SIMPLE  t1      ref     t       t       43      const   10      Using where
376
368
explain select count(*) from t1 where v like 'a%';
377
369
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
378
370
1       SIMPLE  t1      ALL     v       NULL    NULL    NULL    271     Using where
379
371
explain select count(*) from t1 where v between 'a' and 'a ';
380
372
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
381
 
1       SIMPLE  t1      ref     v       v       13      const   10      Using where
 
373
1       SIMPLE  t1      ref     v       v       43      const   10      Using where
382
374
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a  ' and 'b\n';
383
375
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
384
 
1       SIMPLE  t1      ref     v       v       13      const   10      Using where
 
376
1       SIMPLE  t1      ref     v       v       43      const   10      Using where
385
377
alter table t1 add unique(v);
386
378
ERROR 23000: Duplicate entry '{ ' for key 'v_2'
387
379
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a' order by length(concat('*',v,'*',c,'*',t,'*'));
398
390
*a         *a         *a         *
399
391
explain select * from t1 where v='a';
400
392
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
401
 
1       SIMPLE  t1      ref     v       v       13      const   10      Using where
 
393
1       SIMPLE  t1      ref     v       v       43      const   10      Using where
402
394
select v,count(*) from t1 group by v limit 10;
403
395
v       count(*)
404
396
a      1
483
475
g       10
484
476
h       10
485
477
i       10
486
 
select sql_big_result c,count(t) from t1 group by c limit 10;
487
 
c       count(t)
488
 
a      1
489
 
a               10
490
 
b       10
491
 
c       10
492
 
d       10
493
 
e       10
494
 
f               10
495
 
g       10
496
 
h       10
497
 
i       10
498
478
select t,count(*) from t1 group by t limit 10;
499
479
t       count(*)
500
480
a      1
532
512
h       10
533
513
i       10
534
514
drop table t1;
535
 
create table t1 (a char(10), unique (a));
 
515
create temporary table t1 (a char(10), unique (a));
536
516
insert into t1 values ('a');
537
517
insert into t1 values ('a ');
538
518
ERROR 23000: Duplicate entry 'a ' for key 'a'
548
528
update t1 set a='a      ' where a like 'a ';
549
529
update t1 set a='a  ' where a like 'a      ';
550
530
drop table t1;
551
 
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)));
 
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)));
552
532
show create table t1;
553
533
Table   Create Table
554
 
t1      CREATE TABLE "t1" (
555
 
  "v" varchar(10),
556
 
  "c" varchar(10),
557
 
  "t" varchar(50),
558
 
  KEY "v" ("v") USING BTREE,
559
 
  KEY "c" ("c") USING BTREE,
560
 
  KEY "t" ("t"(10)) USING BTREE
561
 
) ENGINE=MEMORY DEFAULT CHARSET=latin1
 
534
t1      CREATE TEMPORARY TABLE `t1` (
 
535
  `v` varchar(10) DEFAULT NULL,
 
536
  `c` varchar(10) DEFAULT NULL,
 
537
  `t` varchar(50) DEFAULT NULL,
 
538
  KEY `v` (`v`) USING BTREE,
 
539
  KEY `c` (`c`) USING BTREE,
 
540
  KEY `t` (`t`(10)) USING BTREE
 
541
) ENGINE=MEMORY
562
542
select count(*) from t1;
563
543
count(*)
564
544
270
589
569
10
590
570
explain select count(*) from t1 where v='a  ';
591
571
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
592
 
1       SIMPLE  t1      ref     v       v       13      const   #       Using where
 
572
1       SIMPLE  t1      ref     v       v       43      const   #       Using where
593
573
explain select count(*) from t1 where c='a  ';
594
574
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
595
 
1       SIMPLE  t1      ref     c       c       13      const   #       Using where
 
575
1       SIMPLE  t1      ref     c       c       43      const   #       Using where
596
576
explain select count(*) from t1 where t='a  ';
597
577
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
598
 
1       SIMPLE  t1      ref     t       t       13      const   #       Using where
 
578
1       SIMPLE  t1      ref     t       t       43      const   #       Using where
599
579
explain select count(*) from t1 where v like 'a%';
600
580
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
601
 
1       SIMPLE  t1      range   v       v       13      NULL    #       Using where
 
581
1       SIMPLE  t1      range   v       v       43      NULL    #       Using where
602
582
explain select count(*) from t1 where v between 'a' and 'a ';
603
583
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
604
 
1       SIMPLE  t1      ref     v       v       13      const   #       Using where
 
584
1       SIMPLE  t1      ref     v       v       43      const   #       Using where
605
585
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a  ' and 'b\n';
606
586
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
607
 
1       SIMPLE  t1      ref     v       v       13      const   #       Using where
 
587
1       SIMPLE  t1      ref     v       v       43      const   #       Using where
608
588
alter table t1 add unique(v);
609
589
ERROR 23000: Duplicate entry '{ ' for key 'v_2'
610
590
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a' order by length(concat('*',v,'*',c,'*',t,'*'));
621
601
*a         *a         *a         *
622
602
explain select * from t1 where v='a';
623
603
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
624
 
1       SIMPLE  t1      ref     v       v       13      const   #       Using where
 
604
1       SIMPLE  t1      ref     v       v       43      const   #       Using where
625
605
drop table t1;
626
 
create table t1 (a char(10), unique using btree (a)) engine=heap;
 
606
create temporary table t1 (a char(10), unique using btree (a)) engine=MEMORY;
627
607
insert into t1 values ('a');
628
608
insert into t1 values ('a ');
629
609
ERROR 23000: Duplicate entry 'a ' for key 'a'
639
619
update t1 set a='a      ' where a like 'a ';
640
620
update t1 set a='a  ' where a like 'a      ';
641
621
drop table t1;
642
 
create table t1 (v varchar(10), c char(10), t varchar(50), key(v(5)), key(c(5)), key(t(5)));
 
622
create temporary table t1 (v varchar(10), c char(10), t varchar(50), key(v(5)), key(c(5)), key(t(5)));
643
623
show create table t1;
644
624
Table   Create Table
645
 
t1      CREATE TABLE "t1" (
646
 
  "v" varchar(10),
647
 
  "c" varchar(10),
648
 
  "t" varchar(50),
649
 
  KEY "v" ("v"(5)),
650
 
  KEY "c" ("c"(5)),
651
 
  KEY "t" ("t"(5))
652
 
) ENGINE=MEMORY DEFAULT CHARSET=latin1
 
625
t1      CREATE TEMPORARY TABLE `t1` (
 
626
  `v` varchar(10) DEFAULT NULL,
 
627
  `c` varchar(10) DEFAULT NULL,
 
628
  `t` varchar(50) DEFAULT NULL,
 
629
  KEY `v` (`v`(5)),
 
630
  KEY `c` (`c`(5)),
 
631
  KEY `t` (`t`(5))
 
632
) ENGINE=MEMORY
653
633
drop table t1;
654
 
create table t1 (v varchar(65530), key(v(10)));
 
634
create temporary table t1 (v varchar(16383), key(v(10)));
655
635
show create table t1;
656
636
Table   Create Table
657
 
t1      CREATE TABLE "t1" (
658
 
  "v" varchar(65530),
659
 
  KEY "v" ("v"(10))
660
 
) ENGINE=MEMORY DEFAULT CHARSET=latin1
661
 
insert into t1 values(repeat('a',65530));
662
 
select length(v) from t1 where v=repeat('a',65530);
 
637
t1      CREATE TEMPORARY TABLE `t1` (
 
638
  `v` varchar(16383) DEFAULT NULL,
 
639
  KEY `v` (`v`(10))
 
640
) ENGINE=MEMORY
 
641
insert into t1 values(repeat('a',16383));
 
642
select length(v) from t1 where v=repeat('a',16383);
663
643
length(v)
664
 
65530
 
644
16383
665
645
drop table t1;
666
646
set storage_engine=InnoDB;
667
 
create table t1 (a bigint unsigned auto_increment primary key, b int,
668
 
key (b, a)) engine=heap;
 
647
create temporary table t1 (a bigint auto_increment primary key, b int,
 
648
key (b, a)) engine=MEMORY;
669
649
insert t1 (b) values (1),(1),(1),(1),(1),(1),(1),(1);
670
650
select * from t1;
671
651
a       b
678
658
7       1
679
659
8       1
680
660
drop table t1;
681
 
create table t1 (a int not null, b int not null auto_increment,
682
 
primary key(a, b), key(b)) engine=heap;
 
661
create temporary table t1 (a int not null, b int not null auto_increment,
 
662
primary key(a, b), key(b)) engine=MEMORY;
683
663
insert t1 (a) values (1),(1),(1),(1),(1),(1),(1),(1);
684
664
select * from t1;
685
665
a       b
692
672
1       7
693
673
1       8
694
674
drop table t1;
695
 
create table t1 (a int not null, b int not null auto_increment,
696
 
primary key(a, b)) engine=heap;
 
675
create temporary table t1 (a int not null, b int not null auto_increment,
 
676
primary key(a, b)) engine=MEMORY;
697
677
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
698
 
create table t1 (c char(255), primary key(c(90)));
 
678
create temporary table t1 (c char(255), primary key(c(90)));
699
679
insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
700
680
insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
701
681
ERROR 23000: Duplicate entry 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl' for key 'PRIMARY'
702
682
drop table t1;
703
 
CREATE TABLE t1 (a int, key(a)) engine=heap;
 
683
CREATE TEMPORARY TABLE t1 (a int, key(a)) engine=MEMORY;
704
684
insert into t1 values (0);
705
685
delete from t1;
706
686
select * from t1;
710
690
a
711
691
0
712
692
drop table t1;
713
 
create table t1 (c char(10)) engine=memory;
714
 
create table t2 (c varchar(10)) engine=memory;
 
693
create temporary table t1 (c char(10)) engine=memory;
 
694
create temporary table t2 (c varchar(10)) engine=memory;
715
695
show table status like 't_';
716
 
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
717
 
t1      MEMORY  10      Fixed   0       12      0       #       0       0       NULL    NULL    NULL    NULL    latin1_swedish_ci       NULL            
718
 
t2      MEMORY  10      Fixed   0       12      0       #       0       0       NULL    NULL    NULL    NULL    latin1_swedish_ci       NULL            
 
696
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 Plugin_name
719
697
drop table t1, t2;
720
 
CREATE TABLE t1(a VARCHAR(1), b VARCHAR(2), c VARCHAR(256),
 
698
CREATE TEMPORARY TABLE t1(a VARCHAR(1), b VARCHAR(2), c VARCHAR(256),
721
699
KEY(a), KEY(b), KEY(c)) ENGINE=MEMORY;
722
700
INSERT INTO t1 VALUES('a','aa',REPEAT('a', 256)),('a','aa',REPEAT('a',256));
723
701
SELECT COUNT(*) FROM t1 WHERE a='a';
730
708
COUNT(*)
731
709
2
732
710
DROP TABLE t1;
733
 
CREATE TABLE t1(c1 VARCHAR(100), c2 INT) ENGINE=MEMORY;
 
711
CREATE TEMPORARY TABLE t1(c1 VARCHAR(100), c2 INT) ENGINE=MEMORY;
734
712
INSERT INTO t1 VALUES('', 0);
735
713
ALTER TABLE t1 MODIFY c1 VARCHAR(101);
736
714
SELECT c2 FROM t1;