~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
drop table if exists t1,t2,t3;
1233.2.1 by Monty Taylor
Renamed instances of HEAP engine to MEMORY. Removed the alias.
2
create temporary table t1 (a int not null,b int not null, primary key (a)) engine=MEMORY comment="testing heaps";
1 by brian
clean slate
3
insert into t1 values(1,1),(2,2),(3,3),(4,4);
4
delete from t1 where a=1 or a=0;
1273.19.10 by Brian Aker
Add support for listing temporay tables from show commands.
5
show table status like "t1";
1320.1.18 by Brian Aker
Overhaul of SHOW TABLE STATUS.
6
Session	Schema	Name	Type	Engine	Version	Rows	Avg_row_length	Table_size	Auto_increment
7
#	test	t1	TEMPORARY	MEMORY	#	#	#	#	#
1273.19.12 by Brian Aker
Enabled more tests.
8
show keys from t1;
1309.2.3 by Brian Aker
Update the code so use a faster index lookup method.
9
Table	Unique	Key_name	Seq_in_index	Column_name
1660 by Brian Aker
MErge in change to do YES/NO like standard requires.
10
t1	YES	PRIMARY	1	a
1 by brian
clean slate
11
select * from t1;
12
a	b
13
2	2
14
3	3
15
4	4
16
select * from t1 where a=4;
17
a	b
18
4	4
19
update t1 set b=5 where a=4;
20
update t1 set b=b+1 where a>=3;
21
replace t1 values (3,3);
22
select * from t1;
23
a	b
24
2	2
25
3	3
26
4	6
1976.6.1 by Brian Aker
This is a fix for bug lp:686197
27
alter table t1 add c int DEFAULT 42 not null, add key (c,a);
1 by brian
clean slate
28
drop table t1;
1106.3.1 by Brian Aker
Heap is now tmp only table
29
create temporary table t1 (a int not null,b int not null, primary key (a)) engine=memory comment="testing heaps";
1 by brian
clean slate
30
insert into t1 values(1,1),(2,2),(3,3),(4,4);
31
delete from t1 where a > 0;
32
select * from t1;
33
a	b
34
drop table t1;
1233.2.1 by Monty Taylor
Renamed instances of HEAP engine to MEMORY. Removed the alias.
35
create temporary table t1 (a int not null,b int not null, primary key (a)) engine=MEMORY comment="testing heaps";
1 by brian
clean slate
36
insert into t1 values(1,1),(2,2),(3,3),(4,4);
1063.9.3 by Brian Aker
Partial fix for tests for tmp
37
alter table t1 modify a int not null auto_increment, engine=innodb, comment="new innodb table";
1273.19.10 by Brian Aker
Add support for listing temporay tables from show commands.
38
show table status like "t1";
1320.1.18 by Brian Aker
Overhaul of SHOW TABLE STATUS.
39
Session	Schema	Name	Type	Engine	Version	Rows	Avg_row_length	Table_size	Auto_increment
40
#	test	t1	TEMPORARY	InnoDB	#	#	#	#	#
1 by brian
clean slate
41
select * from t1;
42
a	b
43
1	1
44
2	2
45
3	3
46
4	4
47
drop table t1;
1233.2.1 by Monty Taylor
Renamed instances of HEAP engine to MEMORY. Removed the alias.
48
create temporary table t1 (a int not null) engine=MEMORY;
1 by brian
clean slate
49
insert into t1 values (869751),(736494),(226312),(802616),(728912);
50
select * from t1 where a > 736494;
51
a
52
869751
53
802616
54
alter table t1 add unique uniq_id(a);
55
select * from t1 where a > 736494;
56
a
57
869751
58
802616
59
select * from t1 where a = 736494;
60
a
61
736494
62
select * from t1 where a=869751 or a=736494;
63
a
64
736494
65
869751
66
select * from t1 where a in (869751,736494,226312,802616);
67
a
68
226312
69
736494
70
802616
71
869751
1106.3.1 by Brian Aker
Heap is now tmp only table
72
create temporary table t2 SELECT * FROM t1;
1063.9.3 by Brian Aker
Partial fix for tests for tmp
73
explain select * from t2 where a in (869751,736494,226312,802616);
1 by brian
clean slate
74
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1063.9.3 by Brian Aker
Partial fix for tests for tmp
75
1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	Using where
76
drop table t1,t2;
1106.3.1 by Brian Aker
Heap is now tmp only table
77
create temporary table t1 (x int not null, y int not null, key x (x), unique y (y))
1233.2.1 by Monty Taylor
Renamed instances of HEAP engine to MEMORY. Removed the alias.
78
engine=MEMORY;
1 by brian
clean slate
79
insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6);
80
select * from t1 where x=1;
81
x	y
82
1	3
83
1	1
84
select * from t1,t1 as t2 where t1.x=t2.y;
1106.3.1 by Brian Aker
Heap is now tmp only table
85
ERROR HY000: Can't reopen table: 't1'
1 by brian
clean slate
86
explain select * from t1,t1 as t2 where t1.x=t2.y;
1106.3.1 by Brian Aker
Heap is now tmp only table
87
ERROR HY000: Can't reopen table: 't1'
1 by brian
clean slate
88
drop table t1;
1233.2.1 by Monty Taylor
Renamed instances of HEAP engine to MEMORY. Removed the alias.
89
create temporary table t1 (a int) engine=MEMORY;
1 by brian
clean slate
90
insert into t1 values(1);
91
select max(a) from t1;
92
max(a)
93
1
94
drop table t1;
1233.2.1 by Monty Taylor
Renamed instances of HEAP engine to MEMORY. Removed the alias.
95
CREATE TEMPORARY TABLE t1 ( a int not null default 0, b int not null default 0,  key(a),  key(b)  ) ENGINE=MEMORY;
1 by brian
clean slate
96
insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
97
select * from t1 where a=1;
98
a	b
99
1	6
100
1	5
101
1	4
102
1	3
103
1	2
104
1	1
105
insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
106
select * from t1 where a=1;
107
a	b
108
1	6
109
1	5
110
1	4
111
1	3
112
1	2
113
1	1
114
1	6
115
1	5
116
1	4
117
1	3
118
1	2
119
1	1
120
drop table t1;
1233.2.1 by Monty Taylor
Renamed instances of HEAP engine to MEMORY. Removed the alias.
121
create temporary table t1 (id int not null, primary key (id)) engine=MEMORY;
1 by brian
clean slate
122
insert into t1 values(1);
123
select max(id) from t1;
124
max(id)
125
1
126
insert into t1 values(2);
127
select max(id) from t1;
128
max(id)
129
2
130
replace into t1 values(1);
131
drop table t1;
1233.2.1 by Monty Taylor
Renamed instances of HEAP engine to MEMORY. Removed the alias.
132
create temporary table t1 (n int) engine=MEMORY;
1 by brian
clean slate
133
drop table t1;
1233.2.1 by Monty Taylor
Renamed instances of HEAP engine to MEMORY. Removed the alias.
134
create temporary table t1 (n int) engine=MEMORY;
1 by brian
clean slate
135
drop table if exists t1;
1106.3.1 by Brian Aker
Heap is now tmp only table
136
CREATE TEMPORARY table t1(f1 int not null,f2 char(20) not 
1233.2.1 by Monty Taylor
Renamed instances of HEAP engine to MEMORY. Removed the alias.
137
null,index(f2)) engine=MEMORY;
1 by brian
clean slate
138
INSERT into t1 set f1=12,f2="bill";
139
INSERT into t1 set f1=13,f2="bill";
140
INSERT into t1 set f1=14,f2="bill";
141
INSERT into t1 set f1=15,f2="bill";
142
INSERT into t1 set f1=16,f2="ted";
143
INSERT into t1 set f1=12,f2="ted";
144
INSERT into t1 set f1=12,f2="ted";
145
INSERT into t1 set f1=12,f2="ted";
146
INSERT into t1 set f1=12,f2="ted";
147
delete from t1 where f2="bill";
148
select * from t1;
149
f1	f2
150
16	ted
151
12	ted
152
12	ted
153
12	ted
154
12	ted
155
drop table t1;
1233.2.1 by Monty Taylor
Renamed instances of HEAP engine to MEMORY. Removed the alias.
156
create temporary table t1 (btn char(10) not null, key(btn)) engine=MEMORY;
1 by brian
clean slate
157
insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
158
explain select * from t1 where btn like "q%";
159
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
160
1	SIMPLE	t1	ALL	btn	NULL	NULL	NULL	14	Using where
161
select * from t1 where btn like "q%";
162
btn
1976.6.1 by Brian Aker
This is a fix for bug lp:686197
163
alter table t1 add column new_col char(1) DEFAULT "Y" not null, add key (btn,new_col), drop key btn;
1 by brian
clean slate
164
update t1 set new_col=left(btn,1);
165
explain select * from t1 where btn="a";
166
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
167
1	SIMPLE	t1	ALL	btn	NULL	NULL	NULL	14	Using where
168
explain select * from t1 where btn="a" and new_col="a";
169
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
520.1.8 by Brian Aker
Updating tests.
170
1	SIMPLE	t1	ref	btn	btn	48	const,const	2	Using where
1 by brian
clean slate
171
drop table t1;
1106.3.1 by Brian Aker
Heap is now tmp only table
172
CREATE TEMPORARY TABLE t1 (
1 by brian
clean slate
173
a int default NULL,
174
b int default NULL,
175
KEY a (a),
176
UNIQUE b (b)
1233.2.1 by Monty Taylor
Renamed instances of HEAP engine to MEMORY. Removed the alias.
177
) engine=MEMORY;
1 by brian
clean slate
178
INSERT INTO t1 VALUES (NULL,99),(99,NULL),(1,1),(2,2),(1,3);
179
SELECT * FROM t1 WHERE a=NULL;
180
a	b
181
explain SELECT * FROM t1 WHERE a IS NULL;
182
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
183
1	SIMPLE	t1	ref	a	a	5	const	2	Using where
184
SELECT * FROM t1 WHERE a<=>NULL;
185
a	b
186
NULL	99
187
SELECT * FROM t1 WHERE b=NULL;
188
a	b
189
explain SELECT * FROM t1 WHERE b IS NULL;
190
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
191
1	SIMPLE	t1	ref	b	b	5	const	1	Using where
192
SELECT * FROM t1 WHERE b<=>NULL;
193
a	b
194
99	NULL
195
INSERT INTO t1 VALUES (1,3);
196
ERROR 23000: Duplicate entry '3' for key 'b'
197
DROP TABLE t1;
1106.3.1 by Brian Aker
Heap is now tmp only table
198
CREATE TEMPORARY TABLE t1 (
1 by brian
clean slate
199
a int default NULL,
200
key a (a)
1233.2.1 by Monty Taylor
Renamed instances of HEAP engine to MEMORY. Removed the alias.
201
) ENGINE=MEMORY;
1 by brian
clean slate
202
INSERT INTO t1 VALUES (10), (10), (10);
203
EXPLAIN SELECT * FROM t1 WHERE a=10;
204
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1685.7.6 by Patrick Crews
Updated test results with changes due to optimizer bug fix. EXPLAIN output now includes 'Using where' for several queries that didn't previously have this output
205
1	SIMPLE	t1	ref	a	a	5	const	3	Using where
1 by brian
clean slate
206
SELECT * FROM t1 WHERE a=10;
207
a
208
10
209
10
210
10
211
DROP TABLE t1;
1233.2.1 by Monty Taylor
Renamed instances of HEAP engine to MEMORY. Removed the alias.
212
CREATE TEMPORARY TABLE t1 (a int not null, primary key(a)) engine=MEMORY;
1 by brian
clean slate
213
INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11);
214
DELETE from t1 where a < 100;
215
SELECT * from t1;
216
a
217
DROP TABLE t1;
1106.3.1 by Brian Aker
Heap is now tmp only table
218
CREATE TEMPORARY TABLE `job_titles` (
520.1.8 by Brian Aker
Updating tests.
219
`job_title_id` int NOT NULL default '0',
1 by brian
clean slate
220
`job_title` char(18) NOT NULL default '',
221
PRIMARY KEY  (`job_title_id`),
222
UNIQUE KEY `job_title_id` (`job_title_id`,`job_title`)
1233.2.1 by Monty Taylor
Renamed instances of HEAP engine to MEMORY. Removed the alias.
223
) ENGINE=MEMORY;
1 by brian
clean slate
224
SELECT MAX(job_title_id) FROM job_titles;
225
MAX(job_title_id)
226
NULL
227
DROP TABLE job_titles;
1233.2.1 by Monty Taylor
Renamed instances of HEAP engine to MEMORY. Removed the alias.
228
CREATE TEMPORARY TABLE t1 (a INT NOT NULL, B INT, KEY(B)) ENGINE=MEMORY;
1 by brian
clean slate
229
INSERT INTO t1 VALUES(1,1), (1,NULL);
230
SELECT * FROM t1 WHERE B is not null;
231
a	B
232
1	1
233
DROP TABLE t1;
1233.2.1 by Monty Taylor
Renamed instances of HEAP engine to MEMORY. Removed the alias.
234
CREATE TEMPORARY TABLE t1 (pseudo char(35) PRIMARY KEY, date int NOT NULL) ENGINE=MEMORY;
1 by brian
clean slate
235
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
DELETE FROM t1 WHERE date<1101106546;
237
SELECT * FROM t1;
238
pseudo	date
239
ZoomZip	1101106546
240
DROP TABLE t1;
1106.3.1 by Brian Aker
Heap is now tmp only table
241
create temporary table t1(a char(2)) engine=memory;
1 by brian
clean slate
242
insert into t1 values (NULL), (NULL);
243
delete from t1 where a is null;
244
insert into t1 values ('2'), ('3');
245
select * from t1;
246
a
247
3
248
2
249
drop table t1;
1233.2.1 by Monty Taylor
Renamed instances of HEAP engine to MEMORY. Removed the alias.
250
set storage_engine=MEMORY;
1106.3.1 by Brian Aker
Heap is now tmp only table
251
create temporary table t1 (v varchar(10), c char(10), t varchar(50));
1 by brian
clean slate
252
insert into t1 values('+ ', '+ ', '+ ');
253
set @a=repeat(' ',20);
254
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
1637 by Brian Aker
Merge in changes to call error on bad data input.
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));
1 by brian
clean slate
261
select concat('*',v,'*',c,'*',t,'*') from t1;
262
concat('*',v,'*',c,'*',t,'*')
261.1.8 by Brian Aker
Merge from Harrison Fisk of the Ebay + Google Hash engine.
263
*+ *+ *+ *
1637 by Brian Aker
Merge in changes to call error on bad data input.
264
*+         *+         *+         *
1 by brian
clean slate
265
show create table t1;
266
Table	Create Table
1106.3.1 by Brian Aker
Heap is now tmp only table
267
t1	CREATE TEMPORARY TABLE `t1` (
1743.5.2 by LinuxJedi
Alter many test cases for the new SHOW CREATE TABLE output
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
1638.10.75 by Stewart Smith
heap.result with explicit COLLATE in SHOW CREATE TABLE
271
) ENGINE=MEMORY COLLATE = utf8_general_ci
1106.3.1 by Brian Aker
Heap is now tmp only table
272
create temporary table t2 like t1;
1 by brian
clean slate
273
show create table t2;
274
Table	Create Table
1106.3.1 by Brian Aker
Heap is now tmp only table
275
t2	CREATE TEMPORARY TABLE `t2` (
1743.5.2 by LinuxJedi
Alter many test cases for the new SHOW CREATE TABLE output
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
1638.10.75 by Stewart Smith
heap.result with explicit COLLATE in SHOW CREATE TABLE
279
) ENGINE=MEMORY COLLATE = utf8_general_ci
1106.3.1 by Brian Aker
Heap is now tmp only table
280
create temporary table t3 select * from t1;
1 by brian
clean slate
281
show create table t3;
282
Table	Create Table
1106.3.1 by Brian Aker
Heap is now tmp only table
283
t3	CREATE TEMPORARY TABLE `t3` (
1743.5.2 by LinuxJedi
Alter many test cases for the new SHOW CREATE TABLE output
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
1638.10.75 by Stewart Smith
heap.result with explicit COLLATE in SHOW CREATE TABLE
287
) ENGINE=MEMORY COLLATE = utf8_general_ci
1 by brian
clean slate
288
alter table t1 modify c varchar(10);
289
show create table t1;
290
Table	Create Table
1106.3.1 by Brian Aker
Heap is now tmp only table
291
t1	CREATE TEMPORARY TABLE `t1` (
1743.5.2 by LinuxJedi
Alter many test cases for the new SHOW CREATE TABLE output
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
1638.10.75 by Stewart Smith
heap.result with explicit COLLATE in SHOW CREATE TABLE
295
) ENGINE=MEMORY COLLATE = utf8_general_ci
1 by brian
clean slate
296
alter table t1 modify v char(10);
297
show create table t1;
298
Table	Create Table
1106.3.1 by Brian Aker
Heap is now tmp only table
299
t1	CREATE TEMPORARY TABLE `t1` (
1743.5.2 by LinuxJedi
Alter many test cases for the new SHOW CREATE TABLE output
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
1638.10.75 by Stewart Smith
heap.result with explicit COLLATE in SHOW CREATE TABLE
303
) ENGINE=MEMORY COLLATE = utf8_general_ci
261.1.8 by Brian Aker
Merge from Harrison Fisk of the Ebay + Google Hash engine.
304
alter table t1 modify t varchar(50);
1 by brian
clean slate
305
show create table t1;
306
Table	Create Table
1106.3.1 by Brian Aker
Heap is now tmp only table
307
t1	CREATE TEMPORARY TABLE `t1` (
1743.5.2 by LinuxJedi
Alter many test cases for the new SHOW CREATE TABLE output
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
1638.10.75 by Stewart Smith
heap.result with explicit COLLATE in SHOW CREATE TABLE
311
) ENGINE=MEMORY COLLATE = utf8_general_ci
1 by brian
clean slate
312
select concat('*',v,'*',c,'*',t,'*') from t1;
313
concat('*',v,'*',c,'*',t,'*')
261.1.8 by Brian Aker
Merge from Harrison Fisk of the Ebay + Google Hash engine.
314
*+ *+ *+ *
1637 by Brian Aker
Merge in changes to call error on bad data input.
315
*+         *+         *+         *
1 by brian
clean slate
316
drop table t1,t2,t3;
1106.3.1 by Brian Aker
Heap is now tmp only table
317
create temporary table t1 (v varchar(10), c char(10), t varchar(50), key(v), key(c), key(t(10)));
1 by brian
clean slate
318
show create table t1;
319
Table	Create Table
1106.3.1 by Brian Aker
Heap is now tmp only table
320
t1	CREATE TEMPORARY TABLE `t1` (
1743.5.2 by LinuxJedi
Alter many test cases for the new SHOW CREATE TABLE output
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,
2363.1.5 by Brian Aker
This patch fixes 798940, we will also just now add the type of index to our create statements.
324
  KEY `v` (`v`) USING HASH,
325
  KEY `c` (`c`) USING HASH,
326
  KEY `t` (`t`(10)) USING HASH
1638.10.75 by Stewart Smith
heap.result with explicit COLLATE in SHOW CREATE TABLE
327
) ENGINE=MEMORY COLLATE = utf8_general_ci
1 by brian
clean slate
328
select count(*) from t1;
329
count(*)
330
270
331
insert into t1 values(concat('a',char(1)),concat('a',char(1)),concat('a',char(1)));
332
select count(*) from t1 where v='a';
333
count(*)
334
10
335
select count(*) from t1 where c='a';
336
count(*)
337
10
338
select count(*) from t1 where t='a';
339
count(*)
340
10
341
select count(*) from t1 where v='a  ';
342
count(*)
343
10
344
select count(*) from t1 where c='a  ';
345
count(*)
346
10
347
select count(*) from t1 where t='a  ';
348
count(*)
349
10
350
select count(*) from t1 where v between 'a' and 'a ';
351
count(*)
352
10
353
select count(*) from t1 where v between 'a' and 'a ' and v between 'a  ' and 'b\n';
354
count(*)
355
10
356
select count(*) from t1 where v like 'a%';
357
count(*)
358
11
359
select count(*) from t1 where c like 'a%';
360
count(*)
361
11
362
select count(*) from t1 where t like 'a%';
363
count(*)
364
11
365
select count(*) from t1 where v like 'a %';
366
count(*)
367
9
368
explain select count(*) from t1 where v='a  ';
369
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
520.1.8 by Brian Aker
Updating tests.
370
1	SIMPLE	t1	ref	v	v	43	const	10	Using where
1 by brian
clean slate
371
explain select count(*) from t1 where c='a  ';
372
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
520.1.8 by Brian Aker
Updating tests.
373
1	SIMPLE	t1	ref	c	c	43	const	10	Using where
1 by brian
clean slate
374
explain select count(*) from t1 where t='a  ';
375
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
520.1.8 by Brian Aker
Updating tests.
376
1	SIMPLE	t1	ref	t	t	43	const	10	Using where
1 by brian
clean slate
377
explain select count(*) from t1 where v like 'a%';
378
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
379
1	SIMPLE	t1	ALL	v	NULL	NULL	NULL	271	Using where
380
explain select count(*) from t1 where v between 'a' and 'a ';
381
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
520.1.8 by Brian Aker
Updating tests.
382
1	SIMPLE	t1	ref	v	v	43	const	10	Using where
1 by brian
clean slate
383
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a  ' and 'b\n';
384
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
520.1.8 by Brian Aker
Updating tests.
385
1	SIMPLE	t1	ref	v	v	43	const	10	Using where
1 by brian
clean slate
386
alter table t1 add unique(v);
387
ERROR 23000: Duplicate entry '{ ' for key 'v_2'
388
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a' order by length(concat('*',v,'*',c,'*',t,'*'));
389
qq
390
*a*a*a*
261.1.8 by Brian Aker
Merge from Harrison Fisk of the Ebay + Google Hash engine.
391
*a *a *a *
392
*a  *a  *a  *
393
*a   *a   *a   *
394
*a    *a    *a    *
395
*a     *a     *a     *
396
*a      *a      *a      *
397
*a       *a       *a       *
398
*a        *a        *a        *
399
*a         *a         *a         *
1 by brian
clean slate
400
explain select * from t1 where v='a';
401
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
520.1.8 by Brian Aker
Updating tests.
402
1	SIMPLE	t1	ref	v	v	43	const	10	Using where
1 by brian
clean slate
403
select v,count(*) from t1 group by v limit 10;
404
v	count(*)
405
a	1
406
a	10
407
b	10
408
c	10
409
d	10
410
e	10
411
f	10
412
g	10
413
h	10
414
i	10
415
select v,count(t) from t1 group by v limit 10;
416
v	count(t)
417
a	1
418
a	10
419
b	10
420
c	10
421
d	10
422
e	10
423
f	10
424
g	10
425
h	10
426
i	10
427
select v,count(c) from t1 group by v limit 10;
428
v	count(c)
429
a	1
430
a	10
431
b	10
432
c	10
433
d	10
434
e	10
435
f	10
436
g	10
437
h	10
438
i	10
439
select sql_big_result trim(v),count(t) from t1 group by v limit 10;
440
trim(v)	count(t)
441
a	1
442
a	10
443
b	10
444
c	10
445
d	10
446
e	10
447
f	10
448
g	10
449
h	10
450
i	10
451
select sql_big_result trim(v),count(c) from t1 group by v limit 10;
452
trim(v)	count(c)
453
a	1
454
a	10
455
b	10
456
c	10
457
d	10
458
e	10
459
f	10
460
g	10
461
h	10
462
i	10
463
select c,count(*) from t1 group by c limit 10;
464
c	count(*)
465
a	1
466
a	10
467
b	10
468
c	10
469
d	10
470
e	10
471
f	10
472
g	10
473
h	10
474
i	10
475
select c,count(t) from t1 group by c limit 10;
476
c	count(t)
477
a	1
478
a	10
479
b	10
480
c	10
481
d	10
482
e	10
483
f	10
484
g	10
485
h	10
486
i	10
487
select t,count(*) from t1 group by t limit 10;
488
t	count(*)
489
a	1
490
a	10
491
b	10
492
c	10
493
d	10
494
e	10
495
f	10
496
g	10
497
h	10
498
i	10
499
select t,count(t) from t1 group by t limit 10;
500
t	count(t)
501
a	1
502
a	10
503
b	10
504
c	10
505
d	10
506
e	10
507
f	10
508
g	10
509
h	10
510
i	10
511
select sql_big_result trim(t),count(t) from t1 group by t limit 10;
512
trim(t)	count(t)
513
a	1
514
a	10
515
b	10
516
c	10
517
d	10
518
e	10
519
f	10
520
g	10
521
h	10
522
i	10
523
drop table t1;
1106.3.1 by Brian Aker
Heap is now tmp only table
524
create temporary table t1 (a char(10), unique (a));
1 by brian
clean slate
525
insert into t1 values ('a');
526
insert into t1 values ('a ');
261.1.8 by Brian Aker
Merge from Harrison Fisk of the Ebay + Google Hash engine.
527
ERROR 23000: Duplicate entry 'a ' for key 'a'
1 by brian
clean slate
528
alter table t1 modify a varchar(10);
529
insert into t1 values ('a '),('a  '),('a   '),('a         ');
530
ERROR 23000: Duplicate entry 'a ' for key 'a'
531
insert into t1 values ('a     ');
532
ERROR 23000: Duplicate entry 'a     ' for key 'a'
533
insert into t1 values ('a          ');
1637 by Brian Aker
Merge in changes to call error on bad data input.
534
ERROR 22001: Data too long for column 'a' at row 1
1 by brian
clean slate
535
insert into t1 values ('a ');
536
ERROR 23000: Duplicate entry 'a ' for key 'a'
537
update t1 set a='a      ' where a like 'a ';
538
update t1 set a='a  ' where a like 'a      ';
539
drop table t1;
1106.3.1 by Brian Aker
Heap is now tmp only table
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)));
1 by brian
clean slate
541
show create table t1;
542
Table	Create Table
1106.3.1 by Brian Aker
Heap is now tmp only table
543
t1	CREATE TEMPORARY TABLE `t1` (
1743.5.2 by LinuxJedi
Alter many test cases for the new SHOW CREATE TABLE output
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,
520.1.8 by Brian Aker
Updating tests.
547
  KEY `v` (`v`) USING BTREE,
548
  KEY `c` (`c`) USING BTREE,
1008.3.10 by Stewart Smith
fix test result now that I fixed SHOW CREATE TABLE
549
  KEY `t` (`t`(10)) USING BTREE
1638.10.75 by Stewart Smith
heap.result with explicit COLLATE in SHOW CREATE TABLE
550
) ENGINE=MEMORY COLLATE = utf8_general_ci
1 by brian
clean slate
551
select count(*) from t1;
552
count(*)
553
270
554
insert into t1 values(concat('a',char(1)),concat('a',char(1)),concat('a',char(1)));
555
select count(*) from t1 where v='a';
556
count(*)
557
10
558
select count(*) from t1 where c='a';
559
count(*)
560
10
561
select count(*) from t1 where t='a';
562
count(*)
563
10
564
select count(*) from t1 where v='a  ';
565
count(*)
566
10
567
select count(*) from t1 where c='a  ';
568
count(*)
569
10
570
select count(*) from t1 where t='a  ';
571
count(*)
572
10
573
select count(*) from t1 where v between 'a' and 'a ';
574
count(*)
575
10
576
select count(*) from t1 where v between 'a' and 'a ' and v between 'a  ' and 'b\n';
577
count(*)
578
10
579
explain select count(*) from t1 where v='a  ';
580
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
520.1.8 by Brian Aker
Updating tests.
581
1	SIMPLE	t1	ref	v	v	43	const	#	Using where
1 by brian
clean slate
582
explain select count(*) from t1 where c='a  ';
583
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
520.1.8 by Brian Aker
Updating tests.
584
1	SIMPLE	t1	ref	c	c	43	const	#	Using where
1 by brian
clean slate
585
explain select count(*) from t1 where t='a  ';
586
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
520.1.8 by Brian Aker
Updating tests.
587
1	SIMPLE	t1	ref	t	t	43	const	#	Using where
1 by brian
clean slate
588
explain select count(*) from t1 where v like 'a%';
589
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1711.6.12 by Brian Aker
This removes the b-tree from heap (it currently crashes the server (both
590
1	SIMPLE	t1	ALL	v	NULL	NULL	NULL	#	Using where
1 by brian
clean slate
591
explain select count(*) from t1 where v between 'a' and 'a ';
592
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
520.1.8 by Brian Aker
Updating tests.
593
1	SIMPLE	t1	ref	v	v	43	const	#	Using where
1 by brian
clean slate
594
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a  ' and 'b\n';
595
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
520.1.8 by Brian Aker
Updating tests.
596
1	SIMPLE	t1	ref	v	v	43	const	#	Using where
1 by brian
clean slate
597
alter table t1 add unique(v);
598
ERROR 23000: Duplicate entry '{ ' for key 'v_2'
599
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a' order by length(concat('*',v,'*',c,'*',t,'*'));
600
qq
601
*a*a*a*
261.1.8 by Brian Aker
Merge from Harrison Fisk of the Ebay + Google Hash engine.
602
*a *a *a *
603
*a  *a  *a  *
604
*a   *a   *a   *
605
*a    *a    *a    *
606
*a     *a     *a     *
607
*a      *a      *a      *
608
*a       *a       *a       *
609
*a        *a        *a        *
610
*a         *a         *a         *
1 by brian
clean slate
611
explain select * from t1 where v='a';
612
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
520.1.8 by Brian Aker
Updating tests.
613
1	SIMPLE	t1	ref	v	v	43	const	#	Using where
1 by brian
clean slate
614
drop table t1;
1233.2.1 by Monty Taylor
Renamed instances of HEAP engine to MEMORY. Removed the alias.
615
create temporary table t1 (a char(10), unique using btree (a)) engine=MEMORY;
1 by brian
clean slate
616
insert into t1 values ('a');
617
insert into t1 values ('a ');
261.1.8 by Brian Aker
Merge from Harrison Fisk of the Ebay + Google Hash engine.
618
ERROR 23000: Duplicate entry 'a ' for key 'a'
1 by brian
clean slate
619
alter table t1 modify a varchar(10);
620
insert into t1 values ('a '),('a  '),('a   '),('a         ');
621
ERROR 23000: Duplicate entry 'a ' for key 'a'
622
insert into t1 values ('a     ');
623
ERROR 23000: Duplicate entry 'a     ' for key 'a'
624
insert into t1 values ('a          ');
1637 by Brian Aker
Merge in changes to call error on bad data input.
625
ERROR 22001: Data too long for column 'a' at row 1
1 by brian
clean slate
626
insert into t1 values ('a ');
627
ERROR 23000: Duplicate entry 'a ' for key 'a'
628
update t1 set a='a      ' where a like 'a ';
629
update t1 set a='a  ' where a like 'a      ';
630
drop table t1;
1106.3.1 by Brian Aker
Heap is now tmp only table
631
create temporary table t1 (v varchar(10), c char(10), t varchar(50), key(v(5)), key(c(5)), key(t(5)));
1 by brian
clean slate
632
show create table t1;
633
Table	Create Table
1106.3.1 by Brian Aker
Heap is now tmp only table
634
t1	CREATE TEMPORARY TABLE `t1` (
1743.5.2 by LinuxJedi
Alter many test cases for the new SHOW CREATE TABLE output
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,
2363.1.5 by Brian Aker
This patch fixes 798940, we will also just now add the type of index to our create statements.
638
  KEY `v` (`v`(5)) USING HASH,
639
  KEY `c` (`c`(5)) USING HASH,
640
  KEY `t` (`t`(5)) USING HASH
1638.10.75 by Stewart Smith
heap.result with explicit COLLATE in SHOW CREATE TABLE
641
) ENGINE=MEMORY COLLATE = utf8_general_ci
1 by brian
clean slate
642
drop table t1;
1106.3.1 by Brian Aker
Heap is now tmp only table
643
create temporary table t1 (v varchar(16383), key(v(10)));
1 by brian
clean slate
644
show create table t1;
645
Table	Create Table
1106.3.1 by Brian Aker
Heap is now tmp only table
646
t1	CREATE TEMPORARY TABLE `t1` (
1743.5.2 by LinuxJedi
Alter many test cases for the new SHOW CREATE TABLE output
647
  `v` VARCHAR(16383) COLLATE utf8_general_ci DEFAULT NULL,
2363.1.5 by Brian Aker
This patch fixes 798940, we will also just now add the type of index to our create statements.
648
  KEY `v` (`v`(10)) USING HASH
1638.10.75 by Stewart Smith
heap.result with explicit COLLATE in SHOW CREATE TABLE
649
) ENGINE=MEMORY COLLATE = utf8_general_ci
520.1.8 by Brian Aker
Updating tests.
650
insert into t1 values(repeat('a',16383));
651
select length(v) from t1 where v=repeat('a',16383);
1 by brian
clean slate
652
length(v)
520.1.8 by Brian Aker
Updating tests.
653
16383
1 by brian
clean slate
654
drop table t1;
261.1.8 by Brian Aker
Merge from Harrison Fisk of the Ebay + Google Hash engine.
655
set storage_engine=InnoDB;
1106.3.1 by Brian Aker
Heap is now tmp only table
656
create temporary table t1 (a bigint auto_increment primary key, b int,
1233.2.1 by Monty Taylor
Renamed instances of HEAP engine to MEMORY. Removed the alias.
657
key (b, a)) engine=MEMORY;
1 by brian
clean slate
658
insert t1 (b) values (1),(1),(1),(1),(1),(1),(1),(1);
659
select * from t1;
660
a	b
661
1	1
662
2	1
663
3	1
664
4	1
665
5	1
666
6	1
667
7	1
668
8	1
669
drop table t1;
1106.3.1 by Brian Aker
Heap is now tmp only table
670
create temporary table t1 (a int not null, b int not null auto_increment,
1233.2.1 by Monty Taylor
Renamed instances of HEAP engine to MEMORY. Removed the alias.
671
primary key(a, b), key(b)) engine=MEMORY;
1 by brian
clean slate
672
insert t1 (a) values (1),(1),(1),(1),(1),(1),(1),(1);
673
select * from t1;
674
a	b
675
1	1
676
1	2
677
1	3
678
1	4
679
1	5
680
1	6
681
1	7
682
1	8
683
drop table t1;
1106.3.1 by Brian Aker
Heap is now tmp only table
684
create temporary table t1 (a int not null, b int not null auto_increment,
1233.2.1 by Monty Taylor
Renamed instances of HEAP engine to MEMORY. Removed the alias.
685
primary key(a, b)) engine=MEMORY;
1 by brian
clean slate
686
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
1106.3.1 by Brian Aker
Heap is now tmp only table
687
create temporary table t1 (c char(255), primary key(c(90)));
1 by brian
clean slate
688
insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
689
insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
690
ERROR 23000: Duplicate entry 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl' for key 'PRIMARY'
691
drop table t1;
1233.2.1 by Monty Taylor
Renamed instances of HEAP engine to MEMORY. Removed the alias.
692
CREATE TEMPORARY TABLE t1 (a int, key(a)) engine=MEMORY;
1 by brian
clean slate
693
insert into t1 values (0);
694
delete from t1;
695
select * from t1;
696
a
697
insert into t1 values (0), (1);
698
select * from t1 where a = 0;
699
a
700
0
701
drop table t1;
1106.3.1 by Brian Aker
Heap is now tmp only table
702
create temporary table t1 (c char(10)) engine=memory;
703
create temporary table t2 (c varchar(10)) engine=memory;
1 by brian
clean slate
704
show table status like 't_';
1320.1.18 by Brian Aker
Overhaul of SHOW TABLE STATUS.
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	#	#	#	#	#
1 by brian
clean slate
708
drop table t1, t2;
1106.3.1 by Brian Aker
Heap is now tmp only table
709
CREATE TEMPORARY TABLE t1(a VARCHAR(1), b VARCHAR(2), c VARCHAR(256),
1 by brian
clean slate
710
KEY(a), KEY(b), KEY(c)) ENGINE=MEMORY;
711
INSERT INTO t1 VALUES('a','aa',REPEAT('a', 256)),('a','aa',REPEAT('a',256));
712
SELECT COUNT(*) FROM t1 WHERE a='a';
713
COUNT(*)
714
2
715
SELECT COUNT(*) FROM t1 WHERE b='aa';
716
COUNT(*)
717
2
718
SELECT COUNT(*) FROM t1 WHERE c=REPEAT('a',256);
719
COUNT(*)
720
2
721
DROP TABLE t1;
1106.3.1 by Brian Aker
Heap is now tmp only table
722
CREATE TEMPORARY TABLE t1(c1 VARCHAR(100), c2 INT) ENGINE=MEMORY;
1 by brian
clean slate
723
INSERT INTO t1 VALUES('', 0);
724
ALTER TABLE t1 MODIFY c1 VARCHAR(101);
725
SELECT c2 FROM t1;
726
c2
727
0
728
DROP TABLE t1;