~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/heap.result

  • Committer: Monty Taylor
  • Date: 2008-11-16 06:29:53 UTC
  • mto: (584.1.9 devel)
  • mto: This revision was merged to the branch mainline in revision 589.
  • Revision ID: monty@inaugust.com-20081116062953-ivdltjmfe009b5fr
Moved stuff into item/

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=MEMORY comment="testing heaps";
 
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
 
show table status like "t1";
6
 
Session Schema  Name    Type    Engine  Version Rows    Avg_row_length  Table_size      Auto_increment
7
 
#       test    t1      TEMPORARY       MEMORY  #       #       #       #       #
8
5
show keys from t1;
9
 
Table   Unique  Key_name        Seq_in_index    Column_name
10
 
t1      YES     PRIMARY 1       a
 
6
Table   Non_unique      Key_name        Seq_in_index    Column_name     Collation       Cardinality     Sub_part        Packed  Null    Index_type      Comment Index_Comment
 
7
t1      0       PRIMARY 1       a       NULL    3       NULL    NULL            HASH            
11
8
select * from t1;
12
9
a       b
13
10
2       2
26
23
4       6
27
24
alter table t1 add c int not null, add key (c,a);
28
25
drop table t1;
29
 
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";
30
27
insert into t1 values(1,1),(2,2),(3,3),(4,4);
31
28
delete from t1 where a > 0;
32
29
select * from t1;
33
30
a       b
34
31
drop table t1;
35
 
create temporary table t1 (a int not null,b int not null, primary key (a)) engine=MEMORY comment="testing heaps";
 
32
create table t1 (a int not null,b int not null, primary key (a)) engine=heap comment="testing heaps";
36
33
insert into t1 values(1,1),(2,2),(3,3),(4,4);
37
 
alter table t1 modify a int not null auto_increment, engine=innodb, comment="new innodb table";
38
 
show table status like "t1";
39
 
Session Schema  Name    Type    Engine  Version Rows    Avg_row_length  Table_size      Auto_increment
40
 
#       test    t1      TEMPORARY       InnoDB  #       #       #       #       #
 
34
alter table t1 modify a int not null auto_increment, engine=myisam, comment="new myisam table";
41
35
select * from t1;
42
36
a       b
43
37
1       1
45
39
3       3
46
40
4       4
47
41
drop table t1;
48
 
create temporary table t1 (a int not null) engine=MEMORY;
 
42
create table t1 (a int not null) engine=heap;
49
43
insert into t1 values (869751),(736494),(226312),(802616),(728912);
50
44
select * from t1 where a > 736494;
51
45
a
69
63
736494
70
64
802616
71
65
869751
72
 
create temporary table t2 SELECT * FROM t1;
73
 
explain select * from t2 where a in (869751,736494,226312,802616);
 
66
alter table t1 engine=myisam;
 
67
explain select * from t1 where a in (869751,736494,226312,802616);
74
68
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
75
 
1       SIMPLE  t2      ALL     NULL    NULL    NULL    NULL    5       Using where
76
 
drop table t1,t2;
77
 
create temporary table t1 (x int not null, y int not null, key x (x), unique y (y))
78
 
engine=MEMORY;
 
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;
79
73
insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6);
80
74
select * from t1 where x=1;
81
75
x       y
82
76
1       3
83
77
1       1
84
78
select * from t1,t1 as t2 where t1.x=t2.y;
85
 
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
86
86
explain select * from t1,t1 as t2 where t1.x=t2.y;
87
 
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       
88
90
drop table t1;
89
 
create temporary table t1 (a int) engine=MEMORY;
 
91
create table t1 (a int) engine=heap;
90
92
insert into t1 values(1);
91
93
select max(a) from t1;
92
94
max(a)
93
95
1
94
96
drop table t1;
95
 
CREATE TEMPORARY TABLE t1 ( a int not null default 0, b int not null default 0,  key(a),  key(b)  ) ENGINE=MEMORY;
 
97
CREATE TABLE t1 ( a int not null default 0, b int not null default 0,  key(a),  key(b)  ) ENGINE=HEAP;
96
98
insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
97
99
select * from t1 where a=1;
98
100
a       b
118
120
1       2
119
121
1       1
120
122
drop table t1;
121
 
create temporary table t1 (id int not null, primary key (id)) engine=MEMORY;
 
123
create table t1 (id int not null, primary key (id)) engine=HEAP;
122
124
insert into t1 values(1);
123
125
select max(id) from t1;
124
126
max(id)
129
131
2
130
132
replace into t1 values(1);
131
133
drop table t1;
132
 
create temporary table t1 (n int) engine=MEMORY;
 
134
create table t1 (n int) engine=heap;
133
135
drop table t1;
134
 
create temporary table t1 (n int) engine=MEMORY;
 
136
create table t1 (n int) engine=heap;
135
137
drop table if exists t1;
136
 
CREATE TEMPORARY table t1(f1 int not null,f2 char(20) not 
137
 
null,index(f2)) engine=MEMORY;
 
138
CREATE table t1(f1 int not null,f2 char(20) not 
 
139
null,index(f2)) engine=heap;
138
140
INSERT into t1 set f1=12,f2="bill";
139
141
INSERT into t1 set f1=13,f2="bill";
140
142
INSERT into t1 set f1=14,f2="bill";
153
155
12      ted
154
156
12      ted
155
157
drop table t1;
156
 
create temporary table t1 (btn char(10) not null, key(btn)) engine=MEMORY;
 
158
create table t1 (btn char(10) not null, key(btn)) engine=heap;
157
159
insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
158
160
explain select * from t1 where btn like "q%";
159
161
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
169
171
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
170
172
1       SIMPLE  t1      ref     btn     btn     48      const,const     2       Using where
171
173
drop table t1;
172
 
CREATE TEMPORARY TABLE t1 (
 
174
CREATE TABLE t1 (
173
175
a int default NULL,
174
176
b int default NULL,
175
177
KEY a (a),
176
178
UNIQUE b (b)
177
 
) engine=MEMORY;
 
179
) engine=heap;
178
180
INSERT INTO t1 VALUES (NULL,99),(99,NULL),(1,1),(2,2),(1,3);
179
181
SELECT * FROM t1 WHERE a=NULL;
180
182
a       b
195
197
INSERT INTO t1 VALUES (1,3);
196
198
ERROR 23000: Duplicate entry '3' for key 'b'
197
199
DROP TABLE t1;
198
 
CREATE TEMPORARY TABLE t1 (
 
200
CREATE TABLE t1 (
199
201
a int default NULL,
200
202
key a (a)
201
 
) ENGINE=MEMORY;
 
203
) ENGINE=HEAP;
202
204
INSERT INTO t1 VALUES (10), (10), (10);
203
205
EXPLAIN SELECT * FROM t1 WHERE a=10;
204
206
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
205
 
1       SIMPLE  t1      ref     a       a       5       const   3       Using where
 
207
1       SIMPLE  t1      ref     a       a       5       const   3       
206
208
SELECT * FROM t1 WHERE a=10;
207
209
a
208
210
10
209
211
10
210
212
10
211
213
DROP TABLE t1;
212
 
CREATE TEMPORARY TABLE t1 (a int not null, primary key(a)) engine=MEMORY;
 
214
CREATE TABLE t1 (a int not null, primary key(a)) engine=heap;
213
215
INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11);
214
216
DELETE from t1 where a < 100;
215
217
SELECT * from t1;
216
218
a
217
219
DROP TABLE t1;
218
 
CREATE TEMPORARY TABLE `job_titles` (
 
220
CREATE TABLE `job_titles` (
219
221
`job_title_id` int NOT NULL default '0',
220
222
`job_title` char(18) NOT NULL default '',
221
223
PRIMARY KEY  (`job_title_id`),
222
224
UNIQUE KEY `job_title_id` (`job_title_id`,`job_title`)
223
 
) ENGINE=MEMORY;
 
225
) ENGINE=HEAP;
224
226
SELECT MAX(job_title_id) FROM job_titles;
225
227
MAX(job_title_id)
226
228
NULL
227
229
DROP TABLE job_titles;
228
 
CREATE TEMPORARY TABLE t1 (a INT NOT NULL, B INT, KEY(B)) ENGINE=MEMORY;
 
230
CREATE TABLE t1 (a INT NOT NULL, B INT, KEY(B)) ENGINE=HEAP;
229
231
INSERT INTO t1 VALUES(1,1), (1,NULL);
230
232
SELECT * FROM t1 WHERE B is not null;
231
233
a       B
232
234
1       1
233
235
DROP TABLE t1;
234
 
CREATE TEMPORARY TABLE t1 (pseudo char(35) PRIMARY KEY, date int NOT NULL) ENGINE=MEMORY;
 
236
CREATE TABLE t1 (pseudo char(35) PRIMARY KEY, date int NOT NULL) ENGINE=HEAP;
235
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);
236
238
DELETE FROM t1 WHERE date<1101106546;
237
239
SELECT * FROM t1;
238
240
pseudo  date
239
241
ZoomZip 1101106546
240
242
DROP TABLE t1;
241
 
create temporary table t1(a char(2)) engine=memory;
 
243
create table t1(a char(2)) engine=memory;
242
244
insert into t1 values (NULL), (NULL);
243
245
delete from t1 where a is null;
244
246
insert into t1 values ('2'), ('3');
247
249
3
248
250
2
249
251
drop table t1;
250
 
set storage_engine=MEMORY;
251
 
create temporary table t1 (v varchar(10), c char(10), t varchar(50));
 
252
set storage_engine=HEAP;
 
253
create table t1 (v varchar(10), c char(10), t varchar(50));
252
254
insert into t1 values('+ ', '+ ', '+ ');
253
255
set @a=repeat(' ',20);
254
256
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
255
 
ERROR 22001: Data too long for column 'v' at row 1
256
 
set @a=repeat(' ',10);
257
 
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
258
 
ERROR 22001: Data too long for column 'v' at row 1
259
 
set @a=repeat(' ',9);
260
 
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
 
257
Warnings:
 
258
Note    1265    Data truncated for column 'v' at row 1
 
259
Note    1265    Data truncated for column 'c' at row 1
261
260
select concat('*',v,'*',c,'*',t,'*') from t1;
262
261
concat('*',v,'*',c,'*',t,'*')
263
262
*+ *+ *+ *
264
 
*+         *+         *+         *
 
263
*+         *+         *+                    *
265
264
show create table t1;
266
265
Table   Create Table
267
 
t1      CREATE TEMPORARY TABLE `t1` (
268
 
  `v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
269
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
270
 
  `t` VARCHAR(50) COLLATE utf8_general_ci DEFAULT NULL
271
 
) ENGINE=MEMORY COLLATE = utf8_general_ci
272
 
create temporary table t2 like t1;
 
266
t1      CREATE TABLE `t1` (
 
267
  `v` varchar(10),
 
268
  `c` varchar(10),
 
269
  `t` varchar(50)
 
270
) ENGINE=MEMORY
 
271
create table t2 like t1;
273
272
show create table t2;
274
273
Table   Create Table
275
 
t2      CREATE TEMPORARY TABLE `t2` (
276
 
  `v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
277
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
278
 
  `t` VARCHAR(50) COLLATE utf8_general_ci DEFAULT NULL
279
 
) ENGINE=MEMORY COLLATE = utf8_general_ci
280
 
create temporary table t3 select * from t1;
 
274
t2      CREATE TABLE `t2` (
 
275
  `v` varchar(10),
 
276
  `c` varchar(10),
 
277
  `t` varchar(50)
 
278
) ENGINE=MEMORY
 
279
create table t3 select * from t1;
281
280
show create table t3;
282
281
Table   Create Table
283
 
t3      CREATE TEMPORARY TABLE `t3` (
284
 
  `v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
285
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
286
 
  `t` VARCHAR(50) COLLATE utf8_general_ci DEFAULT NULL
287
 
) ENGINE=MEMORY COLLATE = utf8_general_ci
 
282
t3      CREATE TABLE `t3` (
 
283
  `v` varchar(10),
 
284
  `c` varchar(10),
 
285
  `t` varchar(50)
 
286
) ENGINE=MEMORY
288
287
alter table t1 modify c varchar(10);
289
288
show create table t1;
290
289
Table   Create Table
291
 
t1      CREATE TEMPORARY TABLE `t1` (
292
 
  `v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
293
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
294
 
  `t` VARCHAR(50) COLLATE utf8_general_ci DEFAULT NULL
295
 
) ENGINE=MEMORY COLLATE = utf8_general_ci
 
290
t1      CREATE TABLE `t1` (
 
291
  `v` varchar(10),
 
292
  `c` varchar(10),
 
293
  `t` varchar(50)
 
294
) ENGINE=MEMORY
296
295
alter table t1 modify v char(10);
297
296
show create table t1;
298
297
Table   Create Table
299
 
t1      CREATE TEMPORARY TABLE `t1` (
300
 
  `v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
301
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
302
 
  `t` VARCHAR(50) COLLATE utf8_general_ci DEFAULT NULL
303
 
) ENGINE=MEMORY COLLATE = utf8_general_ci
 
298
t1      CREATE TABLE `t1` (
 
299
  `v` varchar(10),
 
300
  `c` varchar(10),
 
301
  `t` varchar(50)
 
302
) ENGINE=MEMORY
304
303
alter table t1 modify t varchar(50);
305
304
show create table t1;
306
305
Table   Create Table
307
 
t1      CREATE TEMPORARY TABLE `t1` (
308
 
  `v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
309
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
310
 
  `t` VARCHAR(50) COLLATE utf8_general_ci DEFAULT NULL
311
 
) ENGINE=MEMORY COLLATE = utf8_general_ci
 
306
t1      CREATE TABLE `t1` (
 
307
  `v` varchar(10),
 
308
  `c` varchar(10),
 
309
  `t` varchar(50)
 
310
) ENGINE=MEMORY
312
311
select concat('*',v,'*',c,'*',t,'*') from t1;
313
312
concat('*',v,'*',c,'*',t,'*')
314
313
*+ *+ *+ *
315
 
*+         *+         *+         *
 
314
*+         *+         *+                    *
316
315
drop table t1,t2,t3;
317
 
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)));
318
317
show create table t1;
319
318
Table   Create Table
320
 
t1      CREATE TEMPORARY TABLE `t1` (
321
 
  `v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
322
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
323
 
  `t` VARCHAR(50) COLLATE utf8_general_ci DEFAULT NULL,
 
319
t1      CREATE TABLE `t1` (
 
320
  `v` varchar(10),
 
321
  `c` varchar(10),
 
322
  `t` varchar(50),
324
323
  KEY `v` (`v`),
325
324
  KEY `c` (`c`),
326
 
  KEY `t` (`t`(10))
327
 
) ENGINE=MEMORY COLLATE = utf8_general_ci
 
325
  KEY `t` (`t`())
 
326
) ENGINE=MEMORY
328
327
select count(*) from t1;
329
328
count(*)
330
329
270
521
520
h       10
522
521
i       10
523
522
drop table t1;
524
 
create temporary table t1 (a char(10), unique (a));
 
523
create table t1 (a char(10), unique (a));
525
524
insert into t1 values ('a');
526
525
insert into t1 values ('a ');
527
526
ERROR 23000: Duplicate entry 'a ' for key 'a'
531
530
insert into t1 values ('a     ');
532
531
ERROR 23000: Duplicate entry 'a     ' for key 'a'
533
532
insert into t1 values ('a          ');
534
 
ERROR 22001: Data too long for column 'a' at row 1
 
533
ERROR 23000: Duplicate entry 'a         ' for key 'a'
535
534
insert into t1 values ('a ');
536
535
ERROR 23000: Duplicate entry 'a ' for key 'a'
537
536
update t1 set a='a      ' where a like 'a ';
538
537
update t1 set a='a  ' where a like 'a      ';
539
538
drop table t1;
540
 
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)));
541
540
show create table t1;
542
541
Table   Create Table
543
 
t1      CREATE TEMPORARY TABLE `t1` (
544
 
  `v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
545
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
546
 
  `t` VARCHAR(50) COLLATE utf8_general_ci DEFAULT NULL,
 
542
t1      CREATE TABLE `t1` (
 
543
  `v` varchar(10),
 
544
  `c` varchar(10),
 
545
  `t` varchar(50),
547
546
  KEY `v` (`v`) USING BTREE,
548
547
  KEY `c` (`c`) USING BTREE,
549
 
  KEY `t` (`t`(10)) USING BTREE
550
 
) ENGINE=MEMORY COLLATE = utf8_general_ci
 
548
  KEY `t` (`t`()) USING BTREE
 
549
) ENGINE=MEMORY
551
550
select count(*) from t1;
552
551
count(*)
553
552
270
587
586
1       SIMPLE  t1      ref     t       t       43      const   #       Using where
588
587
explain select count(*) from t1 where v like 'a%';
589
588
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
590
 
1       SIMPLE  t1      ALL     v       NULL    NULL    NULL    #       Using where
 
589
1       SIMPLE  t1      range   v       v       43      NULL    #       Using where
591
590
explain select count(*) from t1 where v between 'a' and 'a ';
592
591
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
593
592
1       SIMPLE  t1      ref     v       v       43      const   #       Using where
612
611
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
613
612
1       SIMPLE  t1      ref     v       v       43      const   #       Using where
614
613
drop table t1;
615
 
create temporary table t1 (a char(10), unique using btree (a)) engine=MEMORY;
 
614
create table t1 (a char(10), unique using btree (a)) engine=heap;
616
615
insert into t1 values ('a');
617
616
insert into t1 values ('a ');
618
617
ERROR 23000: Duplicate entry 'a ' for key 'a'
622
621
insert into t1 values ('a     ');
623
622
ERROR 23000: Duplicate entry 'a     ' for key 'a'
624
623
insert into t1 values ('a          ');
625
 
ERROR 22001: Data too long for column 'a' at row 1
 
624
ERROR 23000: Duplicate entry 'a         ' for key 'a'
626
625
insert into t1 values ('a ');
627
626
ERROR 23000: Duplicate entry 'a ' for key 'a'
628
627
update t1 set a='a      ' where a like 'a ';
629
628
update t1 set a='a  ' where a like 'a      ';
630
629
drop table t1;
631
 
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)));
632
631
show create table t1;
633
632
Table   Create Table
634
 
t1      CREATE TEMPORARY TABLE `t1` (
635
 
  `v` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
636
 
  `c` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL,
637
 
  `t` VARCHAR(50) COLLATE utf8_general_ci DEFAULT NULL,
638
 
  KEY `v` (`v`(5)),
639
 
  KEY `c` (`c`(5)),
640
 
  KEY `t` (`t`(5))
641
 
) ENGINE=MEMORY COLLATE = utf8_general_ci
 
633
t1      CREATE TABLE `t1` (
 
634
  `v` varchar(10),
 
635
  `c` varchar(10),
 
636
  `t` varchar(50),
 
637
  KEY `v` (`v`()),
 
638
  KEY `c` (`c`()),
 
639
  KEY `t` (`t`())
 
640
) ENGINE=MEMORY
642
641
drop table t1;
643
 
create temporary table t1 (v varchar(16383), key(v(10)));
 
642
create table t1 (v varchar(16383), key(v(10)));
644
643
show create table t1;
645
644
Table   Create Table
646
 
t1      CREATE TEMPORARY TABLE `t1` (
647
 
  `v` VARCHAR(16383) COLLATE utf8_general_ci DEFAULT NULL,
648
 
  KEY `v` (`v`(10))
649
 
) ENGINE=MEMORY COLLATE = utf8_general_ci
 
645
t1      CREATE TABLE `t1` (
 
646
  `v` varchar(16383),
 
647
  KEY `v` (`v`())
 
648
) ENGINE=MEMORY
650
649
insert into t1 values(repeat('a',16383));
651
650
select length(v) from t1 where v=repeat('a',16383);
652
651
length(v)
653
652
16383
654
653
drop table t1;
655
654
set storage_engine=InnoDB;
656
 
create temporary table t1 (a bigint auto_increment primary key, b int,
657
 
key (b, a)) engine=MEMORY;
 
655
create table t1 (a bigint auto_increment primary key, b int,
 
656
key (b, a)) engine=heap;
658
657
insert t1 (b) values (1),(1),(1),(1),(1),(1),(1),(1);
659
658
select * from t1;
660
659
a       b
667
666
7       1
668
667
8       1
669
668
drop table t1;
670
 
create temporary table t1 (a int not null, b int not null auto_increment,
671
 
primary key(a, b), key(b)) engine=MEMORY;
 
669
create table t1 (a int not null, b int not null auto_increment,
 
670
primary key(a, b), key(b)) engine=heap;
672
671
insert t1 (a) values (1),(1),(1),(1),(1),(1),(1),(1);
673
672
select * from t1;
674
673
a       b
681
680
1       7
682
681
1       8
683
682
drop table t1;
684
 
create temporary table t1 (a int not null, b int not null auto_increment,
685
 
primary key(a, b)) engine=MEMORY;
 
683
create table t1 (a int not null, b int not null auto_increment,
 
684
primary key(a, b)) engine=heap;
686
685
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
687
 
create temporary table t1 (c char(255), primary key(c(90)));
 
686
create table t1 (c char(255), primary key(c(90)));
688
687
insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
689
688
insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
690
689
ERROR 23000: Duplicate entry 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl' for key 'PRIMARY'
691
690
drop table t1;
692
 
CREATE TEMPORARY TABLE t1 (a int, key(a)) engine=MEMORY;
 
691
CREATE TABLE t1 (a int, key(a)) engine=heap;
693
692
insert into t1 values (0);
694
693
delete from t1;
695
694
select * from t1;
699
698
a
700
699
0
701
700
drop table t1;
702
 
create temporary table t1 (c char(10)) engine=memory;
703
 
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;
704
703
show table status like 't_';
705
 
Session Schema  Name    Type    Engine  Version Rows    Avg_row_length  Table_size      Auto_increment
706
 
#       test    t1      TEMPORARY       MEMORY  #       #       #       #       #
707
 
#       test    t2      TEMPORARY       MEMORY  #       #       #       #       #
 
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  10      Fixed   0       42      0       #       0       0       NULL    NULL    NULL    NULL    utf8_general_ci NULL            
 
706
t2      MEMORY  10      Fixed   0       42      0       #       0       0       NULL    NULL    NULL    NULL    utf8_general_ci NULL            
708
707
drop table t1, t2;
709
 
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),
710
709
KEY(a), KEY(b), KEY(c)) ENGINE=MEMORY;
711
710
INSERT INTO t1 VALUES('a','aa',REPEAT('a', 256)),('a','aa',REPEAT('a',256));
712
711
SELECT COUNT(*) FROM t1 WHERE a='a';
719
718
COUNT(*)
720
719
2
721
720
DROP TABLE t1;
722
 
CREATE TEMPORARY TABLE t1(c1 VARCHAR(100), c2 INT) ENGINE=MEMORY;
 
721
CREATE TABLE t1(c1 VARCHAR(100), c2 INT) ENGINE=MEMORY;
723
722
INSERT INTO t1 VALUES('', 0);
724
723
ALTER TABLE t1 MODIFY c1 VARCHAR(101);
725
724
SELECT c2 FROM t1;